Clustering of structured log data by key schema

ABSTRACT

Clustering structured log data by key schema includes receiving a raw log message. At least a portion of the raw log message comprises structured machine data including a set of key-value pairs. It further includes receiving a map of keys to values. It further includes using the received map of keys to values to determine a key schema of the structured machine data. The key schema is associated with a corresponding cluster. It further includes associating the raw log message with the cluster corresponding to the determined key schema.

CROSS REFERENCE TO OTHER APPLICATIONS

This application claims priority to U.S. Provisional Patent ApplicationNo. 63/031,464 entitled STRUCTURED LOG ANALYSIS filed May 28, 2020 whichis incorporated herein by reference for all purposes.

BACKGROUND OF THE INVENTION

Increasingly, logs for modern applications and cloud infrastructure arein structured formats. This provides various challenges to existing loganalysis systems designed to analyze unstructured log data, limitingtheir efficacy.

BRIEF DESCRIPTION OF THE DRAWINGS

Various embodiments of the invention are disclosed in the followingdetailed description and the accompanying drawings.

FIG. 1 illustrates an embodiment of an environment in which structuredlog analysis is performed.

FIG. 2 illustrates an embodiment of an operator pipeline for clusteringby key schema.

FIG. 3 is a flow diagram illustrating an embodiment of a process forclustering structured log data by key schema.

FIGS. 4A-4G illustrate an embodiment showing interoperability of theLogReduce Keys and LogReduce Values operators.

FIGS. 5A-5C illustrate embodiments of KV structured log data.

FIG. 6A illustrates an embodiment of a JSON key schema.

FIG. 6B illustrates an embodiment of a KV key schema.

FIG. 7 illustrates an embodiment of a user interface.

FIG. 8 illustrates an embodiment of an operator pipeline forimplementing the LogReduce Values operator.

FIG. 9 is a flow diagram illustrating an embodiment of a process forclustering structured log data by values.

FIGS. 10A and 10B illustrate embodiments of a CSV formatted input rawlog.

FIG. 11 illustrates an example list of information that can be providedvia the UI as output of performing the LogReduce Values operator.

DETAILED DESCRIPTION

The invention can be implemented in numerous ways, including as aprocess; an apparatus; a system; a composition of matter; a computerprogram product embodied on a computer readable storage medium; and/or aprocessor, such as a processor configured to execute instructions storedon and/or provided by a memory coupled to the processor. In thisspecification, these implementations, or any other form that theinvention may take, may be referred to as techniques. In general, theorder of the steps of disclosed processes may be altered within thescope of the invention. Unless stated otherwise, a component such as aprocessor or a memory described as being configured to perform a taskmay be implemented as a general component that is temporarily configuredto perform the task at a given time or a specific component that ismanufactured to perform the task. As used herein, the term ‘processor’refers to one or more devices, circuits, and/or processing coresconfigured to process data, such as computer program instructions.

A detailed description of one or more embodiments of the invention isprovided below along with accompanying figures that illustrate theprinciples of the invention. The invention is described in connectionwith such embodiments, but the invention is not limited to anyembodiment. The scope of the invention is limited only by the claims andthe invention encompasses numerous alternatives, modifications andequivalents. Numerous specific details are set forth in the followingdescription in order to provide a thorough understanding of theinvention. These details are provided for the purpose of example and theinvention may be practiced according to the claims without some or allof these specific details. For the purpose of clarity, technicalmaterial that is known in the technical fields related to the inventionhas not been described in detail so that the invention is notunnecessarily obscured.

Many existing log analysis systems are designed to analyze unstructureddata, for example, in order to perform text analysis to infer, derive,or otherwise determine the structure of the unstructured data (e.g., byattempting to perform structure matching based on string similarity).Increasingly, more and more logs are being generated in structuredformats. However, existing string-based log analysis systems (using, forexample, printf( )-oriented algorithms) may not be optimized forprocessing structured data, resulting in potentially lower performancefrom both the perspectives of throughput (e.g., logs-per second) andquality (e.g., user-judged quality of the resulting patterns), which canmake analysis and querying of structured log data difficult.

For example, there is an increasing trend in software development to useformats such as JSON (JavaScript Object Notation) for logging. Forexample, JSON logs are becoming increasingly common, such as for modernapplications that run natively on public clouds. However, such log dataalready has a structure imposed at write time, and analyzing it using anexisting system designed, optimized, tuned, and intended forautomatically extracting structure from a pile of unformatted stringscan lead to issues in which the determined structure does not match theactual structure of the structured log data, which can lead to incorrectresults when performing querying of the log data, as well as performanceissues. Thus, the use of JSON or other structured formats in modernapplications and cloud (AWS, GCP, Azure) IaaS (e.g., S3) and PaaS (e.g.,RDS) logs may limit the value of existing log analysis techniquesdesigned to analyze unstructured logs. For example, existingstring-based systems may incorrectly cluster together JSON dataaccording to a structure template that does not match thestructure/schema of the actual log data. As another example, determiningthe structure of log data may include determining, over a set ofprintf-style log data, what portions are static (e.g., fields that arethe structural elements), and what are variable components (e.g.,values). This may lead to existing string-based analysis systems havingvalue fields as non-wildcarded strings (e.g., incorrectly determiningthat a value is a field/key).

Existing string-based log analysis systems may also suffer performancedegradation because JSON logs, which are typically machine generated andare not designed or formatted for human consumption, may be considerablylonger than typical printf-style logs, and the algorithms for derivingstructure may run into scalability and performance issues whenattempting to process such structured records. These are potentialfailure modes for end users attempting to query the structured log datausing such existing string-based analysis systems.

The following is one example of the problems that would be encounteredusing existing systems (that are tuned for inferring structure fromunstructured data) to analyze structured data. Suppose that a logincludes an address (including city, state, street, zip), a name, aswell as a date. Suppose that this log has the date in the US dateformat. Suppose that another log has the exact same address, name, anddate, but the date is in the European date format, in which the months,date, and year are in different positions. Here, the date is the same,but it is in a different order. Existing systems for analyzingunstructured data, which treat logs as strings, and perform stringsimilarity analysis, may be sensitive to changes in the order ofpresentation, even though it does not actually change the underlyingdata. This sensitivity to order would cause the existing system toincorrectly not match the dates. In contrast, as will be described infurther detail below, the structured log analysis techniques describedherein are structure-aware (e.g., aware of key-value structure presentin the logs being analyzed) and will match based on structure, whichwould result in correctly matching on the address. For example, thestructured log techniques described herein are aware of the structure ofthe data, and are able to line up the different key-value pairs todetermine matches, regardless of their actual position or orderingwithin the log. Thus, for example, the structure-aware log analysistechniques described herein are able to align the street of one log withthe street of another log, even if the streets appear in differentpositions of the two logs. The structured log techniques would beinvariant to such ordering as they have additional information aboutthat structure of the fields. For example, for two logs with the sameset of keys, the techniques described herein, which include techniquesfor clustering structured log data by key schema, would match the twologs together based on the combination of keys present in the logs, evenif the keys are in different positions in the log, while an existingstring-based system may determine that the two logs have differentstructures because the text for those keys are in different positions.

Thus, trying to analyze structured log data using existing stringsimilarity techniques for unstructured log data can lead todeterminations of structures that do not match the actual structure ofthe structured log data, and may cause performance issues where the textsimilarity algorithms are unable to converge on clusters of structures.

It is anticipated that structured machine data log data ingestion willsteadily increase whether from Kubernetes or otherwise. The structuredlog analysis techniques described herein (also referred to herein as“Structured LogReduce”) enable end users to readily interpret thestructured machine data for operational troubleshooting.

Using the techniques described herein, the structure imposed on log dataat write time can be exploited at read/analysis time, and improvedanalysis and querying of structured log data is provided. For example,using the LogReduce Values operator described herein, users may see logsclustered or anomalies detected based on the values of the structureddata (e.g., values of the JSON log data), which is in contrast toexisting systems used to analyze unstructured data, which are tuned toperform structure inference and in some cases, disregard values. Here,using the LogReduce Values operator, users are able to cluster by values(while in some cases ignoring structure), in order to, for example,figure out what are the related loglines based on the values that areappearing. In this way, a user can determine that there is a set ofvalues that are somehow related to each other and may be clusteredtogether.

Using the techniques described herein, process flows are provided forclustering structured log data in a variety of ways that also facilitateexploration and investigation of the structured log data. In variousembodiments, this includes clustering structured log data by key schema,clustering structured log data by values, and facilitating investigationand exploration into determining explanations for the presence ofstructured log data that meet some type of condition or criteria.

As used herein, “key schema” and “key-value” are two different examplerepresentations of structured data. In the example case of JSON:

1. Key schema: the set of string keys in a given JSON object. In someembodiments, nested keys may be “flattened” into this scheme with adelimiter, e.g., a “userId” key under a nested “userInfo” object couldbe “userInfo.userId.”

2. Key-Value: for homogenous key schema, this may convert the data totabular form, with, for example, logs as rows and JSON keys as columns.Heterogeneous schema can be addressed by taking the union of key schemaand adding “NA/Null” values, or other special-casing schemes.

Performing structured log analysis by clustering by key schema andkey-values (using, respectively, the LogReduce Keys and LogReduce Valuesoperators described herein) facilitates summarization of structuredlogs, where, for example, a user is able to approximate the experienceof skimming the full log corpus looking for interesting patterns thatmight provide a jumping off point for further investigation. Using thestructured log analysis techniques described herein:

-   -   Users are provided the option to cluster by key schema    -   Cluster by values may be performed in the case of different key        schema    -   the quality of the resulting clustering may be evaluated    -   Clusters may be represented in a variety of ways to the user.        The degree of intra-cluster variation of each column may be        captured (e.g., ranging from constant to max entropy)    -   The user may see outlier rows, or rows which have ≥1 outlier        value.

As will be described in further detail below, the structured loganalysis techniques described herein further include a “LogExplain”operator that facilitates investigation and exploration of structuredlogs. Suppose, for example, that a user has a (more or less) tabulardataset: logs are rows, and parsed values (e.g., JSON) are the columns.As will be described in further detail below, using the LogExplainoperator described herein, the user may specify some test predicatewhich can be applied to each row/log (e.g., “isFailed==true”), wherethis test predicate is used to partition the dataset into disjoint testand control sets. The LogExplain operator then finds “explanations”amongst the other columns that best distinguish the test set from thecontrol set. In some embodiments, this can be thought of as similar toidentifying highly salient features for supervised binary classificationwith test/control set membership as the class labels.

As one example application, suppose that there are structured logs thatsummarize performance, status, and fine-grained execution details ofsearch jobs. In this setting, engineers often want to troubleshootfailing or unacceptably slow searches, which can be encoded as the testpredicate to the LogExplain operator described herein. In many cases,these failures may be concentrated with respect to either a specificcustomer (e.g., due to unusual query patterns) or due to general load,and these signals may be identifiable via a modeling or algorithmicapproach. In some embodiments, this capability may be considered as aform of automating a search for columns and values which aresignificantly correlated with the user-defined test predicate.

As will be described in further detail below, the ability to performsuch processing may be invoked via operators that an end user is able toenter as user input (e.g., via a UI (user interface)) to a structuredlog analysis system (such as that shown in FIG. 1). The structured loganalysis techniques may be used to analyze log data that is completelystructured data, as well as log data that is in a hybrid format, whichincludes, for example, a printf-style log that has a payload ofstructured data. As will be described below, the operators may beinteroperable, and provide summary analytics over structured data sets.

FIG. 1 illustrates an embodiment of an environment in which structuredlog analysis is performed. In this example, data collection and analysisplatform 102 (also referred to herein as the “platform” or the “system”)is configured to ingest and analyze machine data (e.g., log messages andmetrics) collected from customers (e.g., entities utilizing the servicesprovided by platform 102). End users may also query platform 102 inorder to gain insight into their log data.

In this example, collectors (e.g., collector 104 installed on machine106 of a customer) send logs to the platform over a network (such as theInternet, a local network, or any other type of network, asappropriate); customers may also send logs directly to an endpoint suchas a common HTTPS (Hypertext Transfer Protocol Secure) endpoint.Collectors can also send metrics, and likewise, metrics can be sent incommon formats to the HTTPS endpoint directly. As used herein, logmessages and metrics are but two examples of machine data that may beingested and analyzed by platform 102 using the techniques describedherein. In this example, the collected raw log data includes structureddata, examples of which are described above and throughout. In thisexample, machine 106 has installed collector agent software 104 that isconfigured to collect machine data from one or more sources (which maybe collected from machines other than machine 106). Agent 104 may alsobe configured to interrogate machine 106 directly to collect rawlog/machine data.

Customers sometimes may prefer not to use the collector software (e.g.,provided by the operator of the platform) but instead send logs directlyto the HTTPS service endpoint; this may be utilized in situations whereresources might be too constrained to install the collector software(e.g., mobile phones), or where software installation is not possible(e.g., AWS Lambda).

As shown in this example, the raw machine data is ingested by ingestpipeline 108, which, as one example, is implemented as a servicereceiver cluster. In some embodiments, ingest pipeline 108 operatesbehind a load balancer. In this example, logs are accumulated by eachreceiver into bigger batches before being sent to a message queue. Insome embodiments, once committed to the message queue, the ingestpipeline acknowledges the successful receipt of the raw machine data tothe sender. In this example, after ingestion, the collected logs arestored to logs database 110.

A customer may interact with platform 102 (over a network such as theInternet), for example, by performing queries (e.g., customer query 112)to gain insight into their logs. In one embodiment, the query processoris implemented on the platform via a microservices architecture, wheredifferent services may take customer query input and call other servicesto retrieve and process the log data. In this example, suppose that acustomer would like to gain insight into the structured log data. Theplatform allows the customer to perform queries to explore structuredlog data and/or to explain observed outliers in the structured log data.In some embodiments, the end user may indicate what type of structuredlog analysis they would like to perform by selecting (e.g., via userinput) certain types of operators to perform on structured log data.Examples of structured log analysis operators are described in furtherdetail below. In this example the customer query may be routed to a logsdatabase 110 and/or query processor 114, which is configured to processqueries to platform 102.

As shown in this example, customer query 112 is processed by parsing,preparing, and transformation engine 116. In one embodiment, engine 116uses various analytics operators to “massage” or otherwise transformdata into a tabular format, as well as highlight fields/features ofinterest for the user. The following queries are examples of suchparsing and transformation:

- Log Parsing: _sourceCategory=/libertymutual/*/matcher and “CTICall{” |parse “callIds[UUI]=*,” as UUI | logreduce values on UUI and - JSONParsing: _sourceCategory=“aws/cloudtrail/production” and_collector=“AWS” | json “eventName”, “eventSource”, “awsRegion”,“userAgent”, “userIdentity.type”, “managementEvent”, “readOnly” |logreduce values on “eventName”, “eventSource”, “awsRegion”,“userAgent”, “userIdentity.type”, “managementEvent”, “readOnly”

In this example, the parsing, preparing, and transformation engine 116evaluates the incoming query 112 to determine what logs in logs database110 are of interest. Engine 116 then parses, prepares, and/or transformsthe relevant log data (e.g., structured log data in this example) foranalysis, according to the query. For example, engine 116 is configuredto perform structured parsing on input raw structured log data for inputto downstream operators, such as those described herein.

In some embodiments, the structured parsing operation takes anunstructured data feed and allows users to use a query language to parseand output structured data in the form of a table. For example, theinput data could be JSON/CSV formatted or be a mixed representationusing several formats. In some embodiments, the output is a table formatwith the columns representing the attributes of interest and are readyto be fed into downstream operators explicitly for log analysis, such asthe operators executed by structured log analysis engine 118, describedin further detail below. In one embodiment, engines 116 and 118 areimplemented via complexes of code/classes (e.g., writing in the Scalaprogramming language), which are executed when performing a query (e.g.,by the query processor).

In some embodiments, this phase of structured parsing includes executingan operator to aid in structured log analysis. This operator facilitatesreducing structured logs to clusters of schemas that the user isinterested in, and is a tool to aid in structured log parsing. In someembodiments, this operator facilitates hard-clustering based on keyschema. A user may use this operator to filter structured logs to thosewith a schema of interest. In some embodiments, extracting andclustering on key-schema is performed as part of the LogReduce Keysoperator (described in further detail below), where additional filteringdown to a schema of interest may also be performed by the LogReduce Keysoperator by leveraging engine 116 to perform the filtering.

In some embodiments, this operator is a streaming operator that takes asinput a structured log line (e.g., JSON log line) and parses (e.g., JSONparses) the line up to a user-specifiable depth and outputs the log lineand two additional columns. One column contains a comma separated listof the keys of the flattened object up to a user-specified depth inlexicographic order. Another column contains the hash of the list ofkeys. This hash value is consistent across logs which have the sameschema and can be used to filter out the logs with the same schema(e.g., using an operator to cluster logs by key schema, described infurther detail below). In some embodiments, the process is automatedusing “quicklinks” in the output logs to remove the burden of writingthe query from the user. In some embodiments, quicklinks are a featurefor users to easily open a new pre-defined search of interest. Forexample, in this case, the quicklink redirects the user to a new searchthat is a drill-down having logs with the same JSON schema/belonging tothe same cluster. This assists the user in investigating the logs from aparticular cluster easily without the overhead of writing a new querythemselves. As one example, suppose that a user runs the followingquery:

_sourceCategory=aws/cloudtrail | logreduce keys

which, as will be described in further detail below, generatessignatures of clusters of key-schema, and the user sees a signature ofinterest which has error keys in the signature. The system may generatea quicklink that the user clicks on to open a new search with adrill-down query such as the following:

_sourceCategory=aws/cloudtrail | logreduce keys noaggregate | where_signature_id = “some_hashed_hex_id”

(In some embodiments, in the above, the “noaggregate” option forlogreduce keys is used to return LogReduce results as raw messages.Using this option may disable the aggregation process that runs bydefault—this may be used to support drill-down support, where it may bedesired to retrieve the raw logs which match some particular schema).

This example process of filtering out logs can be understood as a stepin the log analysis workflow where data is cleaned based on schema. Insome embodiments, cleaning the data includes taking a set of logs withvarying schema and filtering down to a homogeneous schema set. Thisresults in data that is easier to analyze/process further because it canbe assumed that the data is uniform in terms of the keys present andtheir meanings. The data can then be fed downstream for other structuredlog analysis operations. For example, structured logs with the same keyschema may be clustered together based on having the same hash value.

In this example, the processed structured log data is then analyzed bystructured log analysis engine 118, which provides results 120 inresponse to the customer query. In some embodiments, structured loganalysis engine 118 is configured to perform clustering of structuredlogs (e.g., clustering by key schema and/or clustering by key-values),and facilitate drilling down into the clusters. In this example,structured log analysis engine 118 is also configured to generatefrequent explanations in a test condition (e.g., failure/outage) versusa normal condition. In some embodiments, this also provides thefunctionality of further drilling down to see subsets of data fulfillinga generated explanation. As will be described in further details below,such structured log analysis may be invoked via a set of operators,which may be used in a standalone manner or in an interoperable manner.

As one example of analyzing structured log data, suppose that a queryingsystem is being monitored. Each time a user runs a query, a log isgenerated. The log includes rich, structured information about the querythat was run. At any given time, some of these queries might fail, taketoo long, or otherwise go wrong. Having such logs may be critical indetermining how a query engine is monitored and troubleshooted. In thisexample, the logs are captured in a structured way.

Suppose that such a structured log were processed by an existingstring-based analysis engine that is attempting to infer the structureof an already structured log. While the existing system may make correctinferences in guessing that certain pieces of data are values, it mayalso make errors in inferring the structure, for example, by missingthat a field is a key (structure) and instead treating it as a value(non-fixed portion of the log data). As another example, the existingstring-based log analysis engine may miss the closing brackets of theJSON data. This is due to the existing system not being optimized forstructured log data.

In some embodiments, using the structured log analysis techniquesdescribed herein, if hybrid raw log data is received, the portion of theraw log data with the structured data of interest is parsed out (e.g.,using an appropriate parser). With respect to hybrid logs, the logs mayalso have more complex nested structures. For example, one entity maywrap all of their logging into JSON data that is like a transportpackage. In this case, the information of interest may be in a singlefield of the JSON log, with various metadata (e.g., where the log camefrom and how it was captured) being in a wrapper of the outer JSON. Theone JSON field has the actual content. However, the inner JSON field maybe an unstructured printf string or structured JSON object itself. Theentity may be only interested in what is in the inner JSON object, inwhich case parsing may be performed in order to perform exploration onthe inner JSON object. If the log is generated directly in a structuredformat (e.g., JSON, CSV, KV, etc.), such processing need not beperformed. After parsing (if needed), the structured log data may thenbe analyzed using the operators described herein. The parsing may beperformed by a user. The parsing may also be performed automatically bythe structured log analysis platform, where the platform is configuredto automatically detect structured data (e.g., to auto-detect JSON dataor structured data of other formats) in collected raw logs and parse outthe structured data. For example, the platform may include a formatdetector to detect the format of the structured data in a log, where theplatform then automatically selects an appropriate parser to apply forthe detected format. In some embodiments, the format detection andparsing described in the above example are performed by parsing,preparing, and transformation engine 116.

The structured log data may then be provided as input for clustering tothe operators described herein. In some embodiments, determining theinput set of log data may also include applying a time range constrainton input log data.

As described above, an end user may delve into their structured log databy specifying or invoking certain operators in their queries. In someembodiments, platform 102 may provide summary analytics over structureddata sets through three operators that are interoperable. For example,as will be described in further detail below, using the operatorsdescribed herein, the following structured log analysis may be performedto address various problems that are experienced in various use cases(such as DevOps use cases and security use cases for User and EntityBehavior Analytics (UEBA)):

(1) Culling noise through the “LogReduce Keys” operator by looking at aset of records and identifying the unique set of combinations acrossthose fields called key schema (i.e., identifying the fixed structure ofthe fields) mapped to frequency called count (aka frequency of patterns)with, for example, deltas presented at the end of the schemas (e.g., thelast 2 rows);

(2) Clustering by finding logs similar to each other through the“LogReduce Values” operator with a frequency analysis so that users canengage in rapid exploratory testing of hypotheses across the landscape(as well as over time) and delve deeper via the quicklinks into theunderlying subset of data; and

(3) Providing an explanation system by identifying outliers through the“LogExplain” operator by getting to an answer quickly through a testcondition application of: (a) surfacing the patterns; (b) providing apercentage of relevance determined by how often it appears in the testcondition vs. a control group; (c) comparing the percentage that thepattern appears in each of the test condition vs. control via testcoverage and control coverage; and (d) exposing the total count that thepattern appears in both the test condition and control (aka samplesize).

In various embodiments, these three operators may be used independentlyor in a cascading manner, as they are interoperable and may be expressedthrough queries. Further, in various embodiments, these three operatorsmay be applied to any log sources. For example, they may be applied toJSON (or CSV) log sources. They may also be applied to various othertypes of structured log sources. Other examples of structured logsources include key-value formatted logs, XML-formatted logs, etc.

These three operators may be particularly beneficial given thatstructured machine data tends to be quite verbose (versus unstructured,typically single line logs), where software assistance is generallyneeded to look at/interpret the structured machine data. In someembodiments, the operators described herein expedite and simplify thisinterpretation, and accelerate analysis and testing of hypotheses.Further, in some embodiments, the operators expose out the reasoning(versus a blackbox analysis stating something is anomalous but nottransparently sharing why).

Further details regarding the LogReduce Keys Operator, the LogReduceValues Operator, and the LogExplain Operator follow.

LogReduce Keys Operator

As described above, in some embodiments, the LogReduce Keys operator,when invoked (e.g., expressed via a search query created by a user), isconfigured to cluster an input set of ingested structured log dataaccording to key schema. This includes clustering structured log data bydifferent combinations of keys. For example, different canonical keyspaces or schema of the structured JSON data in a set of logs may bedetermined. In some embodiments, the most common (combination of) keysthat are present in the input set of structured log data may bepresented. Thus, platform 102 is able to provide to a user a way togroup search results (of a log search query) according to key schema,such that the user may view/explore structured log messages groupedbased on keys.

Providing the ability to cluster structured log data according to keyschema provides various benefits and functionality to end users. Forexample, one reason that key schema might vary is that if a queryrequest failed, there may be some error sub-data structure that providesan error code, error message, etc. (whereas logs for requests that didnot fail might not have these keys present in their logs). Grouping JSONlogs by schema—that is, into the schemas which contain error payloadsand into the schemas which do not—is one example way to programmaticallyseparate the failing and non-failing requests. That is, if there aredifferent schema in the structured log data that represent differentscenarios/situations (e.g., if there is one schema that represents afailing transaction and a different schema that is associated with asuccessful transaction), then the ability to cluster structured log databy key schema, as provided by the structured log analysis systemdescribed herein, can provide useful information, such as the rawfrequency of the occurrence of different types of situations or events.

The input set of data can be narrow or broad in its scope. For example,an end user may know that a certain host or machine being monitored isemitting JSON logs, but may not know what kind of logs they are. Usingthe LogReduce Keys operator described herein, the structured loganalysis platform can provide a high-level table of contents thatindicate the different kinds of logs (e.g., according to keyschema/combinations of keys) that are available to a user for furtheranalysis and exploration.

Using the LogReduce Keys operator described herein, the different“flavors” of logs, identified or represented by the presence ofdifferent combinations of keys (i.e., key schema), may be determined, sothat an end user may have an overview of the types of structured logdata that is present. For example, the keys in the structured log dataare identified by the platform and used to summarize the different typesof key schema that are present in the data.

In some embodiments, the results of clustering an input set ofstructured log data by key schema is presented to a user via a userinterface. The structured log analysis platform may present a summarizedview of the different key schemas identified in the structured log data,where each key schema is associated with a corresponding cluster of logsthat have that key schema. In this way, a user may see what are thedifferent schema that are represented. In some embodiments, thedifferent key schemas are prioritized. As one example, a first keyschema whose cluster has more structured logs than a second key schemacluster may be prioritized ahead of the second key schema (i.e., theclusters, which are each associated with a unique key schema, orprioritized according to the count of the number of logs inside thecluster). In some embodiments, a number of logs present in each cluster(represented by a unique key schema) is presented. For example, based onthe execution of the operator, the user may be presented information viathe UI indicating that there are only two logs that have a certain keyschema. The user may find this odd, and then further explore thatcluster of logs as a hypothesis to further explore or investigate anyissues. In some embodiments, the platform also provides links (alsoreferred to herein as “quicklinks”) to viewing the logs present in a keyschema cluster. In this way, a user can view the actual raw logs thathave a particular key schema.

One example of clustering by key schema is as follows. Structured logdata is received (it may have been received directly in structured form,or extracted from a hybrid log, as described above). An appropriateparser consumes the log, and a structured map of keys to values isoutput. All of the keys in the particular set for the log are captured.In some embodiments, the values are disregarded. Thus, for the onemessage, only the keys have been parsed out. That set of keys then goesinto a schema, and may be used to generate a signature, which is used togroup the log message. That is, the signature for logs in a cluster maybe computed based on the unique keys the group of logs in the clustercontain. The log is then matched to a cluster based on the signatureidentifier. In some embodiments, the signature identifier is a hash ofthe captured keys. In some embodiments, each cluster that is outputtedcorresponds to a unique combination of keys. In some embodiments, whendetermining which cluster to include a log in, the matching of keys isexact, where the key schemas for two logs are either exactly the same orare not.

In some embodiments, after grouping a set of search results according tokey schema as described above, platform 102 provides output. Forexample, the platform may provide a user a view of log messages groupedbased on keys (e.g., JSON keys). The number of messages in a group and asignature for the cluster may also be provided as output.

The user may then take various actions based on the clustering ofstructured log data by key schema. For example, the user may comparechanges in cluster message count over time. As another example, the usermay review messages for clusters that are newly identified before andafter a timestamp. The user may also select one or more keys from asignature to extract into a field or to run subsequent searches. As yetanother example, a user may mark, via a user interface, a cluster as anoutlier/inlier, which may be fed into the LogExplain operator describedherein.

LogReduce Values Operator

Suppose, for example, that now that an end user is able to see thedifferent types of key schemas in the input set of log data, the enduser is now interested in certain fields of interest. For example, auser may wish to further explore a key schema cluster that has a smallnumber of logs. The user can view a subset of their data that ishomogeneous with respect to a certain schema (all the logs in a clusterhave the same JSON schema). The user may have become interested in thatparticular schema due to the low count or number of raw logs in thatcluster that is presented via the UI. Now the user would like to viewthe associated values for that subset of logs in that cluster. In someembodiments, the user can use the LogReduce Values operator describedherein to cluster those logs based on how similar they are with respectto the values (and not necessarily the keys that were in those positionsin the key schema). In this way, when a user creates a query for certainlogs in a batch of structured logs that have been ingested, platform 102may provide the user a way to group the search results (e.g., JSONmessages) based on key-values.

In one example embodiment, the LogReduce Values operator is implementedas a set of stages. For example, the operator receives structured logdata. The structured log data may be received from other operatorsupstream in a stream pipeline. For example, output of the LogReduce Keysoperator may be used as input to the LogReduce Values operator. Afterreceiving structured log data, clustering is used to cluster elementspassing through the operator. When a query finishes, clusters arereturned as an aggregate object for visualizations of the clusters andthe data in them (e.g., to show users the clusters). In someembodiments, cluster objects are made actionable/interactive. As oneexample, cluster objects are made clickable to allow further drill downin the cluster.

Suppose for example that the user would like to determine, within thatkey schema cluster, queries that take longer than a certain amount oftime. For example, based on key schema, there may be a key for executiontiming. Or as another example, the user may like to see informationabout logs in the key schema cluster for a certain value of a field suchas customer-id.

Using the LogReduce Values operator described herein, the user mayfurther cluster a set of input structured log data according to values.While in this example the LogReduce Values operator is used inconjunction with the LogReduce Keys operator described above, theLogReduce Values operator may be used independently as well.

In this example, suppose that the user is interested in the values forthe keys/fields of customer ID (identifier) and caller module—that is,the user would like to determine any patterns in who the customer ismaking a call to and what their status is, and via the caller module,the mechanism by which the customer is calling/executing a search (e.g.,via a scheduled search, API (Application Programming Interface), anemail report, UI, dashboard rendering, etc.). The user may theninvestigate whether there is some pattern in the values of the logs.Here, the user may use the LogReduce Values operator described herein tocluster log data based on the values for certain keys of interest.

In some embodiments, the LogReduce Values operator represents eachlog/record (which is in structured key-value form), by some subset ofthe values that the user is interested in. A clustering algorithm isthen applied to cluster those records together by their similarity withrespect to the values.

After identifying the clusters, the clusters may be post-processed andtransformed.

In this example, the user is clustering the records by the values forthe fields/keys of Customer ID and Caller module. Suppose that based onthe clustering, two clusters result. There is a large cluster ofsearches that are from a concierge (Caller module value) and they arefrom a particular customer (specific value of customer for Customer IDfield). Then there is another set of searches that are from API (anothervalue for Caller module) and they are from a different customer (with adifferent customer ID value). By using this LogReduce Values operator,the user may quickly identify interesting patterns that may indicate tothem where to begin investigating the source/cause of an event. Forexample, suppose that most of the logs are coming from concierge querieslaunched by a customer with customer identifier “123”. This is aninteresting piece of information that the clustering-by-values of theplatform has surfaced to the user from the pile of raw logs. Here, theuser was able to have this information provided to them via inputting anoperator into a UI to cluster log data by values on certain fields(which may be specified by the user when inputting the operator). Thedifferent clusters of values also provide a summary, where each clusteris a potential investigative path or reason for issues that areobserved. The clusters that are formed may then be candidates for adeeper dive.

As another example, suppose that one of the clusters that is generatedshows that logs in that cluster have a value of “unknown” for the CallerModule field. This may be problematic. The user can quickly see this viathe UI via the cluster summary view, and then quickly access the subsetof raw logs that have that pattern of values.

In some embodiments, the platform uses a similarity function todetermine whether a log should be placed in a cluster (or should be usedas a seed of its own cluster if it does not match to an existingcluster). A fuzzy algorithm may be used to account for values beingsimilar, but not exact matches.

As one example of determining whether a log should be assigned to acluster, a similarity function is used to determine how much the logresembles the logs already present in a cluster with respect to a set offields of interest. If the log is similar (e.g., based on comparison toa similarity threshold) to those already in a cluster, then it may beadded to a given cluster, even if it is not a perfect match on every key(but because, for example, it is a perfect match on enough keys). As oneexample, the similarity clustering is based on a distance function onthe set of keys. If it is not similar enough (e.g., based on acomparison to a similarity threshold) to any of the logs in any of theclusters, then the log is placed off on its own cluster, where itbecomes the seed for a new group of logs. In some embodiments, using adifferent set of keys could induce a dramatically different cluster.

In some embodiments, a signature is generated for each cluster. As oneexample, of generating a signature for a log (to identify acorresponding cluster in which to place the structured log), first,structured logs are grouped based on the unique keys they contain. Next,within each group of logs, clusters are created based on similarity ofkey-values. Multiple levels may be supported for nested structured logs.The signature is represented as a list of keys per hierarchy, wheremessages may be clustered by non-changing values.

In some embodiments, when entering the LogReduce Values operator, theuser can also specify the keys of interest, the values of which are tobe used to cluster an input set of logs. This level of user guidance canbe used as the basis for partitioning of logs and may assist theplatform in avoiding clustering logs by values for keys that are noise.The LogReduce Values operator may also be run without specifying keys ofinterest (and the operator will attempt to cluster according to allvalues for all keys, for example).

As shown in the above example, if a hybrid log (that has both structuredand unstructured data) is being analyzed, then the structured payload ofinterest may be extracted from the log. The structured data may begrouped by key schema to obtain a summary of the representations of thelog data by keys. The user identified a particular schema of interestvia the summary view. The user then applied another operator on thesubset of logs in that key schema cluster that are homogeneous withrespect to the schema, in order to cluster that subset of logs by theiractual values and contents. For example, the LogReduce Keys operatorclassified logs by key schema and provided a key schema-bucketed view ofthe logs. The LogReduce Values operator then clustered events togetherbased on similarity with respect to values. The user may then look atfurther clusters of logs with similar values and manipulate thatnarrower subset of logs in a cluster. Thus, after several stages, theuser has gone from a zoomed out, high level summary of logs to, withmachine assistance by the structured log analysis platform, a zoomed inview of a specific subset of logs. This may be done with the user inputof just the two operators described above.

In this example, the cluster that had queries with the value “unknown”for the caller module stood out to the user, and via a link provided bythe platform, the user can view the logs in that cluster. Thus, as shownin this example, a user with minimal expertise may use these operatorsto easily and quickly identify needed information.

In the above example, the operators have been used to extractpotentially strange behaviors of items that are entities that areoccurring in the system. For example, the Customer IDs and Caller Modulekeys and their values are behaviors of specific backend components oractors or entities or systems. Via the operators provided to the user,the user can direct the structured log analysis platform to determinepatterns of behaviors in those components without having knowledge ofthose components, and can determine any associations or relationsbetween what they are doing and how they are doing.

While an example involving JSON structured data was described above forillustrative purposes, the structured log analysis techniques describedherein may be variously adapted to accommodate any type of structureddata as appropriate. For example, the platform can be adapted to analyzeany structured data from unstructured data. Other examples of formatsfor structured data include CSV (comma separated values), other tabularformats (which may be parsed out for example, using regex (regularexpressions)), XML, etc. In some embodiments, the output of theclustering/application of the operators is a data structure that has atabular column-row, key-value structure. A single log may also includemultiple types/formats of structured data. For example, a log mayinclude both JSON fields and CSV formatted data (e.g., CSV in a JSONfield). In some embodiments, the platform applies upstreamparsers/transformations to arrive at a final representation that is astructured mapping of keys to values. For example, a JSON parse could beperformed to determine that a JSON field is CSV. They are then sequencedand pipelined, and the JSON is parsed out. Additionally, the CSV data isparsed out from the JSON field and the union is taken of both of thoseas the final input into the downstream LogReduce Keys/Values operators.

Output may be provided by platform 102 based on the results of theclustering of structured log data by key-values as described above. Forexample, platform 102 may display to a user, via a user interface, logmessages grouped based on key-values. The number of messages in thegroup and the signature for the cluster may also be presented as output.

In some embodiments, based on the results of the clustering bykey-values, the user may perform various actions. As one example, theuser may compare changes in cluster message count over time. The usermay also review messages for clusters that are newly identified beforeand after a timestamp. The user may also select one or more keys from asignature to extract into a field or run subsequent searches. The usermay also mark as a cluster an outlier/inlier to feed to the LogExplainoperator described herein.

The structured log analysis techniques described herein may bebeneficial in a variety of contexts, such as security-oriented usecases. For example, the general purpose behavior analytics platformdescribed herein may be used in the security domain for UEBA (user andentity behavior analytics). For example, in UEBA, users, devices, andservers may be identified as different entities. The behavior of theseentities is modeled and monitored. The system may be monitored to watchfor events such as certain types of communication, the time of day, thelocation of users, etc. Events that occur out of bounds may be flagged.One example of an event is when a user logs into a machine that theyhave never accessed before, or they are logging into a system at a timeof day or from a geographic location in a way that they have previouslynot done.

In such a security domain, the structured log analytics platform maydirect an end-user (analyzing logs that are collected about such events)to entities identified by such fields, and assist the end user inunderstanding how they are behaving or if any entities are behavingdifferently. For example, the end user may cluster logs according tofields/key schema, and then cluster some subset of the data to determinelogs that have certain values for a set of fields (e.g., user name,log-in time, machine that the user logged into, etc.) that are ofinterest to further explore how clusters of users are behaving. Fromthere, for a cluster of users, the system may then be used to detect ifany of the users have changed their behavior from their historicalbehavior.

In addition to the security domain, the structured log analyticstechniques described herein may also be applicable to the ops(operational) domain. For example, the structured log analytics platformmay determine if a node or a container or a Kubernetes pod is behavingstrangely based on its signatures and values that it is emitting. Thisprovides a mechanism by which to detect anomalous behaviors that may beused to prevent events such as outages.

Using the techniques described herein, patterns of behavior may be foundamong fields and values. The behavior of those patterns over time mayalso be evaluated by comparing against historical data (e.g., for logswith certain keys/values, but in a different time range or window oftime).

LogExplain Operator

Using the LogExplain Operator described herein, a user is able todetermine if there is a reason that a value for a set of fields isobserved and whether that reason has to do with certain exploratorykeys. For example, once the user has a broad understanding of their logs(e.g., using the LogReduce Keys and/or LogReduce Values operatorsdescribed above), they may like to dissect them further to understandcausation for a security incident or outage.

In some embodiments, the LogExplain Operator is an operation thatautomatically finds explanations and visualizations that describepatterns on structured log data (e.g., JSON data). For instance, one usecase of the LogExplain operator is to find explanations that can explainwhy one group of logs (also referred to herein as the test set) isdifferent than its complement set (also referred to herein as thecontrol set). In some embodiments, the test set contains logs thatindicate abnormal or outlier system behaviors, while the control setcontains logs that inform the user of expected or baseline (inlier)behavior. In some embodiments, an explanation is defined as a set ofkey-value pairs common to the test set, but rare for the control set.

Continuing the above Ops (Operations) example use case, suppose thatlogs are being generated each time a search is executed. In order toimprove search performance, the user is continuously looking tounderstand why searches were slow, why they failed, or other questionsof this type.

The logs may have a large amount of information. For example, they maybe large hybrid JSON entries, and even within the JSON payload, theremay be a large number of different fields and parameters andmeasurements that encapsulate everything that the machinery trackedabout the execution of a corresponding search.

Here, a user would often want to know what is special about the searchesthat failed. Here the user may use the LogExplain operator to determineexplanations for why some searches failed, which may be indicated by afield in the logs (e.g., failed==1 would appear in the log if thecorresponding search failed, or an error code==failed would appear,etc.). Here, in this example, the user is exploring explanations for thefailing searches in terms of the keys/fields Caller Module and CustomerID. The use of the Caller Module and Customer ID fields are forillustrative purposes in this example, and other exploratory keys may beused. In some embodiments, the LogExplain operator is configured todetermine sets of key-value assignments for those keys that areunusually represented in a set of interest (e.g., those logs forsearches that failed) (where this set of interest is also referred toherein as a “test” set or “target” set), as compared to a “control set.”In this case, the set of interest or test set includes the set of logsthat meet the test condition, in this case, that failed==1. The controlset includes those logs that do not meet the test condition (failed!=1or do not have the failed error code).

The following are illustrative examples of the values for the CallerModule and Customer ID keys. For example, suppose CallerModule==Service. This indicates that the query was launched from a UI.Caller Module==Report indicates that the query was launched from adashboard. Caller Module==Concierge indicates that the query waslaunched to generate an automated email of search results. With respectto Customer ID, different customers (having different identifiers) havedifferent characteristics, data flows, and dependencies, and thus may bea category of interest. Customers may have different data accesspatterns, as well as data ingest rates. The customers may be segmentedor isolated to different subsets of virtual machines or clusters toavoid, for example, the noisy neighbor problem. In cloud workloads, manyworkloads may be placed on a single machine; however, the expectation isthat each customer will appear to have the independent experience ofhaving their own machine. The noisy neighbor problem arises when thisbreaks down. For example, if one customer is mining cryptocurrency anddominating CPU (central processing unit) usage, this may potentiallycause other customers to have a poor experience (e.g., suffer degradedperformance) unless there are effective low-level safeguards to preventit. Ultimately, it is the customers who are experiencing the searchperformance as either satisfactory or not. Thus Customer ID may be animportant key on which to explore explanations for search executionfailures.

Using the LogExplain operator, the user may find explanations for searchexecution failures across these two exploratory keys/dimensions ofCaller Module and Caller ID. As output, a list of explanations isprovided (e.g., via a UI). In some embodiments, each explanation is acombination of values for the exploratory keys Caller Module andCustomer ID, where that combination of values for the keys is presentedas well.

For example, the list of explanations may be provided in the UI in atabular format, where each row corresponds to a unique explanation(e.g., unique combination of the values for at least a subset of theexploratory keys Caller Module and Customer ID, also referred to hereinas a unique combination of key-value assignments). In some embodiments,information about a candidate explanation is also computed and may alsobe displayed. This may include statistical information. One example ofstatistical information is test coverage, which indicates how frequentlya given combination of key-value assignments appears in the test set(e.g., when the searches fail). Control coverage may also be determinedand provided as output, which indicates how frequently the givencombination of key-value assignments appears in the control set (thelogs for searches that did not fail). In some embodiments, anexplanation is also associated with a relevance score, where, in someembodiments, the relevance score is computed based on the ratio of thetest coverage and the control coverage. Candidate explanations may besorted on relevance score. For example, the relevance score may becomputed as a percentage, with explanations sorted in descending orderof relevance.

Based on viewing the outputted results, the user may determine thatthere is a large representation of a certain customer with CustomerID==123. For example, suppose that there were 41,209 searches, of which66 failed. That is, there are 66 log messages in the test set, with theremainder being logs for non-failing searches that are placed in thecontrol set. Suppose that for one row of the output that corresponds tothe explanation Caller Module==Service and Customer ID==123, of the 66failing searches, 8 of them had this combination of values for theexploratory keys, which is 12%, while only 0.61% of the non-failingsearches (control set) had this combination of key-value assignments.This indicates to the user of an over representation of failing searchesthat involve Service-type Calls involving Customer 123. With thishypothesis surfaced to the user by the LogExplain operator, the user maynow have more insights and a starting point into what to investigate(e.g., that there might be issues with Customer 123 and Service CallerModules). Via a link provided by the platform, a user may then view theraw logs corresponding to that explanation.

Using the LogExplain operator functionality, the user can also easilyinvestigate explanations for search failures using other exploratorykeys, such as message time, client overhead, etc.

In some embodiments, frequent item set mining is used in facilitatingthe determining of whether a subset of key-values is overrepresented inthe test set versus the control set. As one example, an apriorialgorithm may be utilized. Other machine learning and data miningtechniques for frequent item set mining may be used, as appropriate, todetermine explanations.

The explanations may include values for subsets of the exploratory keys,where some of the explanations may overlap.

As another example, suppose a security type use case is where a user isevaluating their AWS (Amazon Web Services) audit log (where, forexample, Cloudtrail is the end of such an audit log). The user is tryingto determine if they can explain the presence of “access denied.” Forexample, when hackers try to gain access, a common technique that theyuse is to try to “shake down” infrastructure rights. This may includethe attacker attempting various methods, such as a password cracker, ora tool that attempts various kinds of passwords, usernames, etc.

One potential signal of such an attack would be the attacked systemgiving the hacker access denied-type errors. In this example, supposethat the user is trying to investigate who is causing the “accessdenied” in their infrastructure on what kinds of events, and who thoseusers are. One hypothesis by the user may be that the fields withrespect to which service is being called, which user is calling, andfrom which IP (Internet Protocol) address may be helpful to explain theoccurrence of “access denied.”

The LogExplain operator described herein may be used to explain the“access denied” errors based on this criteria (e.g., set of keys). Here,the user enters into the UI a request to apply the LogExplain operatoron a set of input logs, where the user specifies, via the operator, thatthey would like to see possible explanations for the “access denied”error condition in the logs, where a candidate explanation is a certainpattern or set of values for a set of exploratory keys specified in theoperator. For example, the condition of interest may be that the fielderror code==access denied. Exploratory keys may include event name,username, invoked by, and source IP.

In one embodiment, to determine explanations, the log analysis platformdivides the input log data into two subsets according to the conditionspecified in the operator. Here, for example, the input log data ispartitioned into logs that include the “access denied” error condition(the “test” set), and logs that do not include the “access denied” errorcondition (the “control” set). In some embodiments, for each pattern(e.g., unique combination) of values for the set of exploratory keys,the platform determines whether a given pattern of values for the set ofexploratory keys is disproportionately present in the test set ascompared to the control set (e.g., determine what values for theexploratory keys are more associated with the test set (errorcode==access denied) than the control set (without that error code)). Asdescribed above, in various embodiments, the LogExplain operator isimplemented in part by using an apriori algorithm or any otherappropriate technique for frequent item set mining and association rulelearning. Other data mining or machine learning techniques may also beused.

As output, the LogExplain operator may provide a list of explanationsfor the conditions, where each condition corresponds to a uniquecombination of values for at least some of the keys in the exploratoryset of keys inputted by the user when executing/invoking the LogExplainoperator. For example, every one-key combination, every two-keycombination, every three-key combination, etc. of the exploratory keysare computed as a hypothesis/explanation. In some embodiments,statistics or other information associated with each explanation patternof values is also provided. As described above, this may include acoverage value, which indicates, for each of the test and control setsof logs, the proportion of log messages that have that pattern of valuesfor the exploratory set of keys. For example, if 100% of the logmessages that have “access denied” errors also have some combination ofvalues for a particular explanation pattern, and 0% of the log messagesthat do not have “access denied” errors have that combination of values,then that pattern of values for the exploratory set of keys is a likelycandidate for explaining “access denied” errors.

The following are additional security use case examples of using theLogExplain operator. The following are SecOps examples that pertain toeither machines or users that are behaving in suspicious ways, where thegoal is to identify which machine(s) or user(s) are behavingsuspiciously based on a specific behavior (e.g., sharing data to outsideservers). The following security use case examples are applicable toUEBA. For example, with respect to GuardDuty, a time range of GuardDutymay be used to identify test (outlier) versus control/baseline (inlier)sets in CloudTrail logs in order to test a customersystem/infrastructure. The use of the LogExplain operator describedherein is beneficial to a GuardDuty customer because it expands thecriteria for GuardDuty, helping the customer reduce noise based on whatthey know regarding their architecture.

As a first example, suppose that an end user associated with thecustomer would like to detect if a user, Bob, is accessing AWSapplication programming interfaces (APIs) in an abnormal way. To do so,the following example steps may be performed:

1- tabulate cloudtrail logs pivoted on user = Bob as follows day |eventsource | eventname | geo: city | count | mu + 3-sigma | delta = abs(count − (mu + 3-sigma)) mu + 3-sigma => get this from a lookup table orscheduled search for −30d 2 - INPUT: test_set = delta > 0 in the abovetable 3- OUTPUT: logexplain test_set on eventsource, eventname, city

As a second example, suppose that an end user associated with thecustomer would like to detect abnormal accesses of AWS APIs by anyusers. To do so, the following example steps may be performed:

1- tabulate cloudtrail logs as follows day | user | eventsource |eventname | count mu + 3-sigma | delta = abs (count − (mu + 3-sigma))mu + 3-sigma => get this from a lookup table or scheduled search for−30d 2 - INPUT: test_set = delta > 0 in the above table 3- OUTPUT:logexplain test_set on eventsource, eventname, user

The following is an example customer use case involving the use of theLogExplain operator. Suppose that for a given cluster of logs marked bythe error headline “unexpected error” (where this is, for example, theoutput of the structured LogReduce keys and/or values operator describedabove), a user wishes to find an explanation for why this error headlineis happening by examining the following fields:

1. server/url->this matches the Customer tenant

2. client/appSessionID->this matches a given conferencing session

In some embodiments, LogExplain produces a result at a glance.

The following is an example of a search use case involving theLogExplain operator described herein to explain which customer, servicemodule, or infrastructure is causing search slowness or failedinteractive searches:

_view=failed_interactive_searches !″[stream_shadow″ | parse″explainJsonPlan.ETT *″ as ettJson | json field=ettJson ″customerId″,″callerModule″, ″tiers″, ″slowdownReason″, ″exitCode″ | logexplainexitCode = 1 on customerId, callerModule, tiers, slowdownReason DevOpsuse case 2: errors by host _(——)sourceCategory=stream | if(_raw matches“error”, 1, 0) as hasError | count by hasError, _sourceHost | logexplainhasError = 1 on _sourceHost

As described above, various combinations of numbers of exploratory keysare evaluated as potential explanations/hypotheses for explaining thecondition of interest. In some embodiments, the list of explanations(combinations of values for the exploratory keys) is presented via a UI.The list of explanations may be ranked according to an overall score(e.g., relevance score, as described above). In some embodiments,filtering may be performed to combine explanations that might beredundant. For example, explanations that are redundant may be pooledinto a larger group. In this way, a user has fewer explanations to haveto review. Such filtering may be invoked via a flag entered along withthe operator.

Thus, the LogExplain operator described herein provides a tool forperforming a more explicit focused search for the set of key values thatwill be overrepresented in a set of logs that meet a test conditionversus a control set of logs (that do not meet the test condition).

For example, after executing a search in response to a user createdquery to investigate a set of structured logs ingested by platform 102(where the user may have previously grouped/clustered logs using theLogReduce Keys and/or Values operators described above), platform 102may provide the user with a way to identify outliers versus inliers inthe data. As one example, one cluster of messages (e.g., resulting fromthe use of the LogReduce Keys and/or Values operator) may be marked asoutliers, while another cluster indicated as inliers. The indicating maybe done via cluster identifiers. As another example, inliers versusoutliers may be identified based on time series. As yet another exampleof identifying outliers versus inliers in the data, a user may specify afield in the structured log data (e.g., bytes_sent for VPC (VirtualPrivate Cloud) flow logs, a type of network traffic log used in cloudenvironments such as Amazon Web Services (AWS) or Google Cloud Platform(GCP)) with a statistical operator metric (e.g., mean+3*standarddeviations or Median-Absolute-Deviation) to identify outliers. In someembodiments, after executing a search, platform 102 also optionallyallows a user to specify dimensions for a base explanation. In someembodiments, platform 102 also provides the field and values that bestseparate outliers from inliers. In some embodiments, a user may basefurther searches on the explanation dimensions (e.g., explanatory keysdescribed above). For example, if a specific Internet Protocol (IP)address is determined to be the cause/explanation for outliers in VPCflow logs bytes_sent, the user may search for messages referencing thatIP address for further investigation.

As described above, the above structured log analysis techniques providebenefits over existing systems when analyzing structured data. Forexample, existing systems that are optimized for unstructured log datamay attempt to group logs by text similarity, and then apply analignment to try and identify which aspects of the log are changing, andthen bucket the logs accordingly. Using such techniques for analysis ofunstructured data and applying them to structured data can produceinaccurate and ineffective analysis results. For example, because anexisting system is oblivious to the structure of the structure data, itwill attempt to refine the structure itself, and will try to infer whatare the keys and values. In effect, existing techniques treat an entirelog as a string. Whereas, for example, the LogReduce Keys operatordescribed herein, because it is aware of the key-value structure, it isable to group the logs by aligning the different events, joining them onthe key-value structure, and then performing a clustering algorithm inthat representation. Here, the data is treated differently as structuredkey-value data, and the structured log analysis platform determinessimilarity and patterns in that representation. It would be difficult toretrofit existing systems that are tuned for analyzing unstructured logdata because they operate on a different set of assumptions and datarepresentations (because they operate on the assumption that they aretaking strings as input, not a data structure that includes key-valuepairs). It would also be difficult to use an existing system tuned forunstructured logs to cluster structured logs by values (e.g., as is doneby using the LogReduce Values operator described herein), because theexisting unstructured log analysis systems are designed to inferstructure from unformatted strings, while disregarding the values (whichvary and are not considered part of the structure). The structured loganalysis techniques described herein are optimized for structured datato find similarity between structured data representations, versus flatstrings, which are different algorithmic problems. Here, the structuredlog analysis techniques provide mechanisms for structure-aware eventclustering and common-value motif mining.

While string similarity log analysis systems may be useful wheninformation about the data is unknown (e.g., because it is unformatted),it may not be suited for structured log data, as described above.Further, existing string-based systems attempt to derive some type ofstructure from unstructured data, and may generate templates, by whichlogs are grouped. Grouping logs by templates of derived structure is adifferent type of grouping from grouping logs by values as describedherein.

Here, the structured log analysis techniques described herein have adifferent data structure representation/data types as compared toexisting log analysis techniques for unstructured data. For example,traditional systems for analyzing unstructured log data accept strings,while the structured log analysis techniques described herein acceptmaps from string to string, and may have a richer data structure. Insome embodiments, the map is generated as the output of a parser (e.g.,JSON parser, CSV parser, etc.).

Further Example Details and Embodiments Regarding LogReduce Keys

As described above, the LogReduce Keys operator allows users to exploreand group structured logs by their schema. In some embodiments, theinput to the LogReduce Keys operator is structured logs in the form ofraw, unparsed logs. Each of the logs may have a separate schema, whichmay be common across some of the logs, and different across the rest.The LogReduce Keys operator described herein allows a user to selectlogs with a certain schema and explore the selected logs further.

In one embodiment, executing the LogReduce Keys operator includesperforming lexicographical sorting of input schema/column names parsedout from structured logs (e.g., using parsing engine 116 of platform102). The lexicographically sorted input schema/column names are thenhashed to produce a value corresponding to that order of schema names.In this way, the same schema will have the same hash value. In someembodiments, the LogReduce Keys operator then outputs the same logs inan unparsed format, but with a new column containing the hash value. Insome embodiments, the user is able to select those logs downstream usingthe value in this column.

The LogReduce Keys operator may be executed in a standalone manner. Theoutput of the LogReduce Keys operator may also be consumed by furtherdownstream operators (LogReduce Values and/or LogExplain operators). Ifthere is no further downstream operator (e.g., the LogReduce Keysoperators is the last in a pipeline of operators being executed), insome embodiments, the operator produces aggregate results by performinga count by operation on an identifier of a schema and/or the keys in theschema. Additional post-processing steps may also be performed toreorder the schema keys by frequency across rows, and lexicographicallyacross columns as well, to generate quicklinks for further drilldown.

If there is a further downstream operator, then in some embodiments, theresults of executing the LogReduce Keys operator are not aggregated. Insome embodiments, quicklinks, which will link to a new query with a“where” filter (that, for example, filters on schema identifier), is oneexample subset of this condition.

The following is example query syntax:

1. Example Base case: Downstream of JSON Parsing_sourceCategory=aws/cloudtrail | logreduce keys Or if there is a need,the following may be expressed, | json auto [parser] json automaxdepth=2 Allow downstream operations on results_sourceCategory=aws/cloudtrail | logreduce keys | count by _some_field_sourceCategory=aws/cloudtrail | logreduce keys noaggregate | logexplain_signature_id = “ABC” against _signature_id = “123” on a, b, c =======

In some embodiments, the LogReduce Keys Operator is implemented as anoperator pipeline (in which multiple operators are executed). As oneexample, there are two pipelines to implement the functionality of theLogReduce Keys Operator.

As one example input to the operator, the input is from a parsingoperator. In some embodiments, upon receiving a “PLUS” element, theoperator pipeline performs lexicographic sorting of all non-Null keysand generates a hash using a hashing function.

The following is an example visualization of an output schema of theLogReduce Keys Operator. Two example ways of showing the output schemaare provided below:

-   -   The first is to add additional columns to the existing log        output with the hash value, as shown in the below example output        schema.

Time Message Schema String Schema Hash

Example Output Schema

In some embodiments, parsed fields are also available (e.g., with anadditional field containing the hashed code for a particular schema).

In some embodiments, a human readable comma separated list of fields isadded as the schema string. The schema hash provides a way for users tobe able to perform further operations for a subset of logs uniquelyidentified by the schema hash.

-   -   Another example option is to show the hash for the schema along        with a count of the logs that match a hash in the Aggregates        tab.

In the first case, it might warrant the user to look through all pagesof results to find all the possible schema hashes. Although, in someembodiments, the user can run a count on the results themselves toobtain the second format.

FIG. 2 illustrates an embodiment of an operator pipeline for clusteringby key schema. In some embodiments, the operator pipeline shown in FIG.2 is implemented by structured log analysis engine 118 of platform 102.In this example, the operator pipeline of FIG. 2 is configured toproduce an aggregate result with counts of each schema and a drilldownpresented in the form of a quicklink. In this example, auto engine 202is configured to automatically detect objects in logs of a certainformat (e.g., automatically detect JSON objects in logs, where such anautomatic JSON parser is also referred to in various examples herein as“JSON-Auto”) and extract the key/value pairs. This may be performedwithout the need to specify fields in a parse statement

LogReduce Keys engine 204 is configured to determine key-schema of thelogs. In some embodiments, LogReduce Keys engine 204 further includes apipeline for performing mapping, which may include mapping the log to akey-schema signature/cluster. In some embodiments, the mapping pipelineis configured to produce non-aggregate results, and tags each rawmessage to a schema type and/or a schema list. This provides flexibilityto a user to use the operator for their own downstream use cases, aswell as to enable quicklinks for drilling down further to filter downthe logs (e.g., using post processing engine 208, described in furtherdetail below).

Count by engine 206 is configured to count logs. This includes a“reduction” phase (corresponding to the mapping phase described above)in which a count is maintained of how often a key-schema is seen (e.g.,number of logs mapped to that key-schema). In some embodiments, thecount by engine is implemented via Scala classes.

Post processing engine 208 is an operator that is configured to operateon the aggregate results generated by the count-by operation performedby count-by engine 206. In some embodiments, the post processingoperator performs two operations: (1) sorting of schema keys for easyreadability, and (2) generation of quicklinks for drilldown. Thefollowing is one example of sorting schema keys. In some embodiments,the schema keys are sorted for each row based on the overall frequencyof each key and across rows lexicographically. This allows a tree-likeview which makes reading this information easier. In some embodiments,ellipses are added in an aggregate user interface (UI) for this.

The following is one example implementation of generating quicklinks. Insome embodiments, the quicklinks are generated using the original searchstring—where the query prior to the LogReduce Keys clause is maintainedand appended with a specific “noaggregate” query (e.g., to return rawlogs, as described above) followed by a where filter on the schema hash.In some embodiments, the quicklink opens a new search tab maintainingthe search parameters such as time range, parsing information, timestamp(message/receipt time), etc.

In one example implementation, a new query is formatted using uniformresource locator (URL) formatting, such as shown below:

/ui/#/search/@${timeRange.getStartTime},${timeRange.getEndTime}@${encodedQuery}

However, it may be difficult to preserve all the search parametersefficiently, as well as to maintain the changes if there are changes tothe query creation parameter.

One example alternative to create these search queries is to use aservice for generating shortcodes, which in some embodiments takes asearch instance and customer information to generate a shortcode whichuniquely identifies the quicklink. In some embodiments, a shortcode isgenerated for every schema.

Example Trade-Offs and Edge Case Handling

The below section discusses possible edge cases that may arise fromimplementation, and steps to address them. JSON structured data isdescribed in the below example for illustrative purposes. In variousembodiments, the techniques described herein may be variously adapted toaccommodate any type of structured data, as appropriate.

Upstream Fields/Fields Mentioned in Query

In some embodiments, data in the search pipeline is stored in a datastructure that has two parts—a specific schema portion which is inferredfrom the search query and may be an array of fixed length, and a dynamicpart with data that is extracted as a part of an operator (which cannotbe anticipated at query time until the data is seen and processed). Someexample implementations consider an “addFields” in a tuple that isreceived from upstream operators. The “addFields” refers to theaforementioned dynamic portion of a stream tuple element, and in someembodiments may be implemented as Map[fieldname, datatype]. In someembodiments, the LogReduce keys operator utilizes this dynamic addFieldsportion of the data structure, since, in some embodiments, a parserextracts the field (e.g., from JSON) dynamically/on the fly and storesthem in this element of a tuple. In some embodiments, this does notinclude any built-in fields or fields that were added to the schema as aresult of the query. This may arise in two cases:

-   -   Fields are received that are a consequence of upstream        operations like a parse or a split operation. This brings up the        question of whether these fields are intended to be considered        in the schema or would the user only expect it to be working on        the JSON/key-value part of their logs    -   In some embodiments, the user is not permitted to write a query        with either the fields/keys parameter,

_sourceCategory=aws/cloudtrail | json auto “<fieldName>” | logreducekeys

Writing the query in the above way may not align with the intention ofthe operator to begin with, but in some embodiments, mentioning such afield may drop it from being considered in the schema hash.

One example way to solve this is to change the query as,

_sourceCategory=aws/cloudtrail | logreduce keys parser= json

In this case, the possibility is taken away of the user making mistakesin the automatic parser (e.g., automatic JSON parsing by auto engine202) and creating the operator pipeline in the backend with the autoengine followed by LogReduce Keys.

Or, as another example, a global analysis of the query may be performedto see what fields were mentioned in the auto engine (e.g., “JSON-auto”)and consider those values from an “inputSchema.” As described above withrespect to the “addedFields,” in some embodiments, the static part ofthe stream tuple described above is an array of fixed length. This maybe inferred when the engine is built based on the fields that areexpected in the output as seen from a query. This schema may be updatedby some operators, and may be fed from one operator to another in asearch pipeline. In some embodiments, the upstream schema an operatorreceives from the operator prior is referred to as the “inputSchema.”

Another example way to solve both the points above is to consider boththe inputSchema fields as well as the fields in addedFields for hashing.In some embodiments, facilitating this includes filtering built-inschema fields, Field Extraction Rules (FERs), and FSRs (Field StorageRules). In some embodiments, field extraction rules are parsers that auser can define at runtime or ingest time on their own logs. The formermay be much easier than the others.

-   -   There may be fields injected due to Field Extraction Rules that        come into the operator. This may be a trickier case because the        user may not be aware of all the FERs available on their        environment and this could affect the results they see in a way        they do not understand. In some embodiments, FER fields are        filtered out and the algorithms are run on the others.

Example of how user experience may be affected:

-   -   The FER could be generated from meta-data and the user can        receive different schema hashes for identical logs which differ        in meta-data information.    -   The FER could be extracted from part of the log that was not        JSON and not of relevance to them, but the schema hashes could        differ because of the FER.    -   The FER could have a conflict with a JSON-auto field which can        only be resolved by calling out the field in the JSON-auto        query—this would cause issues mentioned above.

In the FER case, it is also to be considered what significance FERsusually have to a user. In some embodiments, in order to filter FERs, aview for the schema may be requested which provides only built-in fieldsand FERs and filters them out.

User Parsing Out JSON into a Field

There could be a use case where the user parses out JSON from the logupstream and would want to run LogReduce Keys on the extracted JSON.

For example,

((_sourceCategory=stream “explainJsonPlan.ETT”)) | parse“explainJsonPlan.ETT *” as parsed_ett | logreduce keys field=parsed_ett

In one embodiment, the implementation uses JSON auto to detect JSONblobs in the log and if the user has logs that follow the recommendedformat, this would work for it.

The ability for the user to parse and specify the parsed field as atarget may be extended using a “fields” option of an automatic parseraccordingly. For example in a hybrid log case, the “fields” optionsallows a user to specify which “top level/outer” field to apply theautomatic parser to (e.g., which field contains the further nestedpayload JSON).

FIG. 3 is a flow diagram illustrating an embodiment of a process forclustering structured log data by key schema. In some embodiments,process 300 is executed by platform 102 of FIG. 1. In some embodiments,process 300 is executed in response to a user invoking the LogReduceKeys operator described herein. The process begins at 302 when a raw logmessage is received. At least a portion of the raw log message includesstructured machine data that includes a set of key-value pairs. At 304,a map of keys-to-values is received. In some embodiments, the map ofkeys-to-values is generated using a parser. At 306, the received map ofkeys-to-values is used to determine a key schema of the structuredmachine data. This may include dropping or discarding the values fromthe map of keys-to-values generated by the parser. The key schema isassociated with a corresponding cluster. At 308, the raw log message isassociated with the cluster corresponding to the determined key schema.

The following are examples illustrating various portions of process 300.Examples involving JSON and KV format cases are described below forillustrative purposes. In some embodiments, unless separate JSON and KVcases are specifically mentioned, the below applies to both formats.

FIG. 4C illustrates an embodiment of JSON structured log data.

FIGS. 5A-5C illustrate embodiments of KV structured log data.

The following are examples of parsers for extracting structured datafrom a log message (e.g., from structured and semi-structured raw logmessages).

KV _index=streamlogs explainJsonPlan ETT | parse “INFO *explainJsonPlan.ETT” as _kv | logreduce keys parser=keyvalue field=_kvJSON _index=streamlogs explainJsonPlan ETT | parse “explainJsonPlan.ETT*” as _json | logreduce keys field=_json

The following is an example of a user input using the LogReduce Keysoperator described herein:

2020-05-18 15:00:00,784 -0700 INFO [LOGTYPE=TELEMETRY.CUSTOMER][hostId=***12345ABC] [module=STREAM] [localUserName=stream][logger=stream.internals.EttPlansCache$] [thread=MTP-RawOutputProcessor-Session-0.123456789-ABCDEFG-1][auth=User:user@demo.com:00000012345:01234XYZ:false:DefaultSumoSystemUser:12:USERNAME_PASSWORD] [sessionId=S12345ABCD] [callerModule=service][remote_ip=12.34.56.78] [web_session=node123] [api_session=XYZ123][remotemodule=stream] [execution_interface=UI] [query_flags=]explainJsonPlan.ETT {“version” : 2.0, “customerId” : “01234XYZ”,“sessionId” : “F12345ABCD”, “buildEngineDt” : 278, “parseQueryDt” : 12,“executionDt” : 50 ...

The following are examples of maps usable to extract key schema ofstructured log data in a raw log message.

JSON ...explainJsonPlan.ETT {“version” : 2.0, “customerId” : “01234XYZ”,“sessionId” : “S12345ABCD”, “buildEngineDt” : 278, “parseQueryDt” : 12,“executionDt” : 50 ... KV ...INFO [LOGTYPE=TELEMETRY.CUSTOMER][hostId=***12345ABC ] [module=STREAM] [localUserName=stream][logger=stream.internals.EttPlansCache$][thread=MTP-RawOutputProcessor-Session-0.123456789-ABCDEFG-1][auth=User:user@demo.com:00000012345:01234XYZ:false:DefaultSumoSystemUser:12:USERNAME_PASSWORD] [sessionId=S12345ABCD] [callerModule=service][remote_ip=12.34.56.78] [web_session=node123] [api_session= XYZ123][remotemodule=stream] [execution_interface=UI] [query_flags=]explainJsonPlan.ETT ...

The following are examples of how the maps are applied to the structuredlog data to determine the key schema of the structured log data. Asdescribed above, the key schema may be extracted or otherwise determinedby discarding the values from the map of keys-to-values generated by aparser.

JSON { version:2, customerId:“01234XYZ”, sessionId:“S12345ABCD”,buildEngineDt:278, parseQueryDt:12, executionDt:502, ett:5949,slowdownReason:“UnKnown”, isInteractiveQuery:true, exitCode:0,statusMessage:“Finished successfully”, ... Becomes the below extractedkey schema Version, customerId, sessionId, buildEngineDt, parseQueryDT,executionDt, Ett, slowdownReason, isInteractiveQuery, exitCode,statusMessage KV [LOGTYPE=TELEMETRY.CUSTOMER] [hostId=***12345ABD][module=STREAM] [localUserName=stream][logger=stream.internals.EttPlansCache$][thread=MTP-RawOutputProcessor-Session-9.876543210-1][auth=User:user2@demo.com:00000045678:01234XYZ:false:DefaultSumoSystemUser:12:USERNAME_PASSWORD][sessionId=S45678EFGH] [callerModule=report] [remote_ip=98.76.54.321][web_session=node456] [api_session=ASXYZ123] [remotemodule=dashboard][execution_interface=UI] [query_flags=] Becomes the below extractedkey-schema api_session, auth, callermodule, execution_interface, hostid,localusername, logger, logtype, module, remote_ip, remotemodule,sessionid, thread, web_session

The following are examples of key schema (e.g., combinations of keysextracted from the structured log data), as well as data structurerepresentations.

FIG. 6A illustrates an embodiment of a JSON key schema.

FIG. 6B illustrates an embodiment of a KV key schema.

In some embodiments, the keys are represented as a Set[String] (e.g., aSet of Strings, in Scala).

One example implementation of determining a key schema is to run aparser and discard the values. A modified parser may also be used thatignores the values as it parses.

One example of how to determine, based on the extracted key schema,which cluster (e.g., in a set of clusters) to associate a raw logmessage with is as follows. For each message, the Set[String] isextracted, and then the message is grouped by equality of this datastructure.

The following is one example of how a raw log message is included orotherwise associated with a particular cluster. In one embodiment, eachlog is augmented with this schema data structure (Set[String]), and thenan SQL-style GROUPBY-COUNT operation is applied in a query language(e.g., the Sumo Query Language), resulting in a tabular output mappingeach schema (Set[String]) to its associated count of raw logs. In someembodiments, this data is internally represented as a Map[Set[String],Int] (map/dictionary/table) from schema to count.

Table 1 below illustrates examples of identifiers of clusters:

TABLE 1 a 12345ABCDE auth, hostid, localusername, logger, logtype, 98module, remotemodule, sessionid, thread, callermodule 2 XYZ123ABC auth,hostid, localusername, logger, logtype, 2 module, remotemodule,sessionid, thread, callermodule, customer 3 DEFGHI987 auth, hostid,localusername, logger, logtype, 100 module, remotemodule, sessionid,thread, callermodule, execution_interface, remote_ip

The following are examples of information that may be provided as output(e.g., via a UI).

FIG. 7 illustrates an embodiment of a user interface. The example outputof FIG. 7 includes schema (e.g., what keys) along with the count (e.g.,how many logs). In this example, the count itself is also a hyperlinkthat can be clicked to retrieve the actual raw logs associated with thatschema for either direct inspection or further query processing(potentially including additional parsing and aggregation).

The following is an example embodiment of how to highlight (e.g., in aUI) the differences between key schema clusters.

In one embodiment, in order to maximize the usefulness to the user forquick/easy visual inspection, the schema Set[String] results arepresented as follows:

-   -   First, the keys are sorted according to global frequency (e.g.,        in how many logs does a given key appear?)—i.e., pulling the        most important/common keys “forward” to the beginning of the        list. Note that in some embodiments these global frequencies can        be reconstructed from the Map[Map[String,String], Int] schema        count data structures by summing the counts of all        Map[String,String] schema in which a given key appears.    -   Second, the schemas themselves are sorted lexicographically by        the sequence of key strings. The motivation of this step is to        “align” matching/similar keys across schema, in order to        maximize the obviousness of differences/discrepancies between        adjacent schema rows in the final results.

The following is an alternative embodiment of presenting clusterdifferentiation using an additional clustering algorithm. In thisexample, clusters are presented as “diff-style” versus some central“reference schema.” That is, for example:

1. Define a pairwise distance function between schema sets (e.g., someedit distance—such as the minimum number of entries that should beadded/removed in order to convert one into the other)

2. Find the “centroid” of all schemas (e.g., which has a minimum averagedistance to all other schemas)—define it as the reference schema

3. Present the reference schema as the 1st results, and represent allother schemas in terms of their diff versus the reference

Further Example Details and Embodiments Regarding LogReduce Values

As described above, in some embodiments, the LogReduce Values operatoroperates on structured log data to cluster the structured log data bykey-values. In some embodiments, executing the operator includes runninga categorical clustering algorithm and output cluster centers. In someembodiments, these cluster centers are made click-able, and the abilityto drill-down into these cluster centers may be provided by anotheroperator that allows results to be consumed by downstream operators suchas the LogExplain operator.

In one embodiment, the LogReduce Values operator is implemented as thefollowing example stages:

1. The LogReduce Values operator receives structured data from operatorsupstream in a stream pipeline.

2. Clustering: Using stream clustering to cluster the stream elementspassing through the operator.

3. When the query finishes, the clusters are returned as an aggregateobject for visualizations of the clusters and the data in them.

4. The cluster objects are made clickable (e.g., by using an additionaloperator) to further drill down in the cluster.

Input Format

The following are two example input formats for the LogReduce Valuesoperator:

1. Raw objects (e.g., raw JSON objects) that are typed as strings thatare valid structured data.

2. Pre-parsed tabular data where, for example, the key is the columnname and the value is the row entry for that column.

There may be various tradeoffs for the different types of input formats.For example, input format 1 above may benefit the user by allowing theuser to feed in logs with little or minimal preprocessing and parsing.As a consequence of accepting raw strings (e.g., raw JSON strings), insome embodiments, the operator should internally manage the parsingstep, which may limit the flexibility of users who want to define theirown parsing beforehand. On the other hand, example input format 2 mayallow more flexibility than example input format 1, but it may notprevent users from feeding the operator meaningless inputs such as rawJSON or nested JSON objects as entries in a column, which may put theresponsibility on the user to correctly obtain what they send to theoperator. Although example input format 1 allows the user to provide noinitial preprocessing, most use cases may involve users parsing,filtering, and transforming fields before feeding the input to thestructured log clustering operator. In some embodiments, a table-informat is forced to the operator.

FIG. 8 illustrates an embodiment of an operator pipeline forimplementing the LogReduce Values operator. In some embodiments, theoperator pipeline shown in FIG. 8 is implemented by structured loganalysis engine 118 of platform 102. Clustering engine 802 is configuredto cluster input structured data. The clustering engine is configured totake the input from upstream operators and generate cluster centers. Insome embodiments, the clustering engine uses a trait clusteringalgorithm 804, which is configured to cluster categorical data streams.In some embodiments, the trait clustering algorithm defines therequirements that any categorical stream clustering algorithm/modelsshould satisfy. In some embodiments, the requirements include protocolsto initialize the state of the clustering algorithm and updateunderlying data structures (i.e., the cluster centers) as data is beingfed as a result of the algorithm, and also perform bookkeeping of theresulting data structure (e.g., estimating true data cardinality,estimating data structure memory, etc.). In some embodiments, the traitclustering algorithm 804 utilizes a clustering data structure 806. Insome embodiments, the clustering data structure keeps track of thefrequency of key-value pairs seen in the logs for each cluster. Thefacilitates more efficient lookup of which keys and values are commonlyassociated with a cluster. In one embodiment, the clustering datastructure is implemented as a two-level hash map of keys->values andvalues->counts. The clustering data structure may also prune key-valuepairs that occur rarely in a cluster and are thus not associated withthe cluster.

The LogReduce Values operator described herein may be used forinteractive searches. The following is an example interactive search. Anembodiment of a workflow for the structured LogReduce Values operatorsis shown below:

_sourceCategory=aws/cloudtrail | json_sourceCategory=“aws/cloudtrail/production” and _collector=“AWS” | json“eventName”, “eventSource”, “awsRegion”, “userAgent”,“userIdentity.type”, “managementEvent”, “readOnly” | logreduce valuesfields=eventName,eventSource,awsRegion,userAgent

In some embodiments, the LogReduce Values operator ignores defaultfields such as message and time fields unless the field is specified asa parameter. In some embodiments, since message and time are unlikely tobe categorical data, the clustering algorithm may not be able tomeaningfully use these fields to cluster log lines.

The following are example parameters to the LogReduce Values operator:

‘fields’, (required in some embodiments): takes as input a list ofcolumn values which is a subset of input column values. In someembodiments, LogReduce Values is run on this subset of fields if theparameter is not specified.

The following are example inputs and outputs to the LogReduce Valuesoperator:

One example of an input to the LogReduce Values operator is data in atabular format. In some embodiments, input to the LogReduce Valuesoperator includes non-aggregate data that is output from upstreamoperators (e.g., output from parsing JSON, CSV, XML, and other parsedformats). In some embodiments, in response to a “start” element (thatspecifies the start of the data stream to be queried), a clustering datastructure is initialized, and building of the clustering data structureis started. In some embodiments, in response to receiving a “plus”element (e.g., actual data payload elements, such as actual logelements), an element is routed to the prebuilt structure, where thestructure is updated with the element. In some embodiments, in the datapayload (e.g., “plus” case), an element is a single row of the table,representing the log message and its current extracted fields. As oneexample, it may be implemented as a Scala Map[String, Any] where thefield names are the keys. In some embodiments, in response to receivinga “flush” element, the current histogram centers are outputted asaggregate output. In some embodiments, the “flush” element is a controlelement that indicates that the user interface wants to obtain partialresults to show the user of the analysis in progress. One example outputfrom the LogReduce Values operator is the histogram centers as anaggregate output. In some embodiments, the output is provided inresponse to receiving an “end” element. In some embodiments, the “end”element is a control signal indicating that all data elements have beensent and that the final analysis/query can be completed.

The following are example parameters of LogReduce Values:

-   -   Fields: the columns that the user wants to use to cluster the        data    -   Output_threshold: a number (e.g., between 0 and 1) that        indicates the minimum frequency a key-value pair can have in        order to be output. For example, if a customerID of        000000000000000A only shows up in 20% of logs in a cluster, then        an output_threshold of 0.2 and above will suppress this        key-value pair from showing up in the output.

In some embodiments, on returning histogram centers, a histogram may berepresented by one or more of the following example options:

1. Key-value pairs where the keys are, for example, JSON keys, and thevalues are the mode of the categorical distribution.

2. Key-value frequency pairs—this includes dumping the approximatehistogram object into, for example, a JSON object schema.

The following is an example of an output schema. For example, the outputof the user defined query (in which the LogReduce Values operator isexpressed) may have the following example schema:

-   -   Histogram representation: To show the cluster centers    -   Count: Number of logs in the cluster    -   Cluster Label: these include labels generated and assigned to        the histogram/cluster centers as they are formed, and would, for        example, start at 1 and go up to the number of clusters    -   QuickLink: link to the logs in the specific cluster—        -   In some embodiments, this encodes the mode of the histogram            cluster representation in a search “quicklink” URL (uniform            resource locator), which points to a search query with the            fields as the mode of the histogram        -   In some embodiments, this uses an operator (also referred to            herein as the LogReduce Values-details operator) associated            with LogReduce Values to further drill down into results,            including to link to the cluster shortcode for that specific            cluster which would be used to obtain logs which fall into            that cluster. Further details regarding the “details”            operator are described below.

Example Embodiments Regarding the LogReduce Values-Details Operator

In some embodiments, upon finishing clustering and creating theapproximate histograms, the serialized representations of the clusteredhistograms are written to a temporary location, in an S3 bucket. In someembodiments, while serializing, the hyper-parameters of the clusteringalgorithm are written, as well as the location and identity of targetclusters in the drill down URL.

In some embodiments, the output clusters from the LogReduce Valuesoperator are clickable via a drill down URL in the quicklink part of theoutput, and use the LogReduce Values-details operator described hereinto fetch the histogram of the corresponding cluster and rerun theclustering algorithm against the histogram fetched and filter out alllogs which do not fall in that cluster as defined, for example, by thehyper-parameters (e.g., distance/threshold).

In some embodiments, if the user wants to drill down on a particularLogReduce values query identifier and cluster identifier, a link, suchas shown in the example below, may be provided that leads to thefollowing query.

_sourceCategory=“aws/cloudtrail/production” and _collector=“AWS” | json“eventName”, “eventSource”, “awsRegion”, “userAgent”,“userIdentity.type”, “managementEvent”, “readOnly” | logreducevalues-details <shortcodeID> [clusterId=<cluster id>]

In some embodiments, if the user wants to label the raw logs by theircluster ids for further processing, they can use the following examplequery:

_sourceCategory=“aws/cloudtrail/production” and _collector=“AWS” | json“eventName”, “eventSource”, “awsRegion”, “userAgent”,“userIdentity.type”, “managementEvent”, “readOnly” | logreducevalues-details <shortcodeID> | ...

The following are example parameters to the LogReduce Values-DetailsOperator:

‘shortcode_id”: this may be used to link to the serialized histogramsand fetches them. Once fetched, they may be used to re-cluster the logsin the same query and match them to their respective clusters

“cluster_label”: In some embodiments, the cluster label is passed as aquery parameter to the LogReduce Values-Details Operator which can takeeither a list of labels as a parameter where, for example, it onlymatches the logs against the histograms of those labels or no labelswhere all logs are returned with a new field which is the cluster label,on which the LogExplain operator described herein may be ran downstream.In some embodiments, for drilling down, the cluster label to thisoperator is passed, which returns non-aggregated output of all logs withthat cluster label.

In some embodiments, to account for the amount of time that S3 objectsstay alive, a TTL (time to live) for each object is set by default. Insome embodiments, if a user runs the same query multiple times, that istreated as a regular search query being run multiple times.

LogReduce Values-Details Operator: Input and Output

Example Input: In some embodiments, the input is in a “table-in” (e.g.,tabular) format. The input may include non-aggregate data that is outputfrom upstream operators. This may include the output of parsing JSON,CSV, XML, and other parsed formats. In some embodiments, on receivingthe START element (e.g., a control signal that indicates/specifies thestart of the data stream to be queried, as described above), theclustering data structure is loaded using a shortcode URL and reading aserialized version from S3. In some embodiments, on receiving the PLUSelement, the element is routed to the loaded data structure, the rightcluster is assigned to it, and a new field (e.g., called “cluster”) isadded to the input data element, thereby adding a new column called“cluster” to the incoming logs after inferring the cluster using theprecomputed histograms using the shortcode ID S3 mechanism. In someembodiments, on receiving the FLUSH element, the logs are outputted withthe additional “cluster” column added to the log line.

Example Output: In various embodiments, the output includesnon-aggregated output, with the same schema as the input format, but,for example, added with an extra “cluster” column which denotes clustermembership.

Example Drill Down State Representation

In some embodiments, for the drill down operator, the state of aprevious structured log clustering query is stored. In some embodiments,the following may be performed:

-   -   1. Store the serialized cluster histograms. The serialized        histograms may be sufficient to reassign the raw logs into the        same cluster by computing the similarity measure for each log        for each cluster.    -   2. Store the message identifiers (ids). The message ids allow        for past messages to be perfectly grouped by their cluster by,        for example, joining the raw dataset on their message ids.

Option 2 may lead to a faster implementation and may more reliablyretrieve the same logs that were previously assigned to a cluster.Option 1 may be much less space intensive than option 2.

Example Embodiments of Clustering a Data Structure

-   -   In some embodiments, each stream node has a map of (customer,        query/session) key vs an instance of the clustering algorithm        for the pair.    -   In some embodiments, this structure is an in-memory data        structure.    -   In some embodiments, the clustering algorithm handles the data        access layer of cluster data objects—in this example case, an        approximate histogram.    -   In some embodiments, the approximate histogram for each cluster        is represented by a two-level tree of hash maps where primary        keys (level 1) correspond to j son/csv keys and secondary keys        (level 2) correspond to possible values a json/csv key is paired        with. In some embodiments, for each primary and secondary key,        the frequency is stored of key-value pairs for logs assigned to        the cluster and the maximum error incurred from pruning.    -   In some embodiments, the clustering data structure supports the        following example operations:

trait ClusterHistogram { def add(event_key: String, event_name: String):Unit def get_frequency_estimate(event_key: String, event_name: String):Int def get_mode_estimate: Map[String, Tuple2[String, Int]]

In some embodiments, an example of an internal, cluster histogramstructure in the following format is displayed:

Example primary key: {‘secondary key 1’: (frequency, max error),‘secondary key 2’: (frequency, max error), ...} Example of DataStructure on a synthetic Dataset: eventVersion: {′1.05′: (24, 0)}userIdentity.type: {′IAMUser′: (24, 0)} userIdentity.accountId:{′*************′: (24, 0)} userIdentity.accessKeyId: {″: (24, 0)}userIdentity.userName: {′**********′: (24, 0)} eventTime:{′2019-12-01T17:49:50Z′: (3, 0), ′2019-12-04T17:49:50Z′: (1, 0),′2019-12-08T17:49:51Z′: (1, 0), ′2019-12-10T17:49:50Z′: (23, 0)}sourceIPAddress: {′***.***.**.**′: (9, 0) ′**.***.**.***′: (15, 0)}userAgent: {′Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0)Gecko/20100101 Firefox/48.0′: (24, 0)} ... recipientAccountId:{′**************: (24, 0)} Further Details regarding Clustering

In some embodiments, there is a limit on the number of clusters. Forexample in some embodiments, the number of signatures produced by thealgorithm is no more than O(log n) where n is the number of data pointsclustered.

In some embodiments, clustering mode collapse is prevented. Modecollapse may occur when a large majority of the data points areallocated to one or two clusters. For example, the first clustercontains nearly 80% of logs in the dataset. In addition, this clusterprovides no insight into the data since there is no associated signaturewith the cluster.

The following is a first example of categorical attribute clustering,where attributes, as used herein, refer to key-value pairs in structuredlogs.

This example clustering method involves leveraging information fromcategorical attributes in structured logs.

In some embodiments, to cluster logs based on categorical attributes, adistance function is first defined that equally takes into account logsof various structured schema. An example distance function forillustrative purposes is a variant of the K-modes distance function thataccounts for schema differences between JSON logs. For example, let Xand Y be two flattened, JSONlogs with not necessarily the same schema.Structured log X contains keys from set K_(x) and structured log Ycontains keys from set KY. In some embodiments, the distance functionbetween flattened JSONs is defined as follows:

${d\left( {X,Y} \right)} = {\frac{1}{{K_{X}\bigcup K_{Y}}}\left( {{\Sigma_{k \in {K_{X}\bigcap K_{Y}}}1\left\{ {X_{K} \neq Y_{K}} \right\}} + {\gamma{{K_{X} \oplus K_{Y}}}}} \right)}$

where ⊕ denotes the symmetric difference and γ>=1 denotes additionalcost incurred if a key is missing from either schema. In this example,dividing by the union schema is performed to account for the fact thatstructured logs with large schemas are more likely to have more uncommonfields and thus larger distances. In some embodiments, if this term isnot included, logs with a small number of attributes are more likely tobe grouped together despite having different schemas or attributes. Insome embodiments, to cluster the logs, a streaming k-modes clusteringalgorithm may be used.

In some embodiments, once the logs are clustered, signatures may befound by taking the mode of all j son fields that exist within acluster. In some embodiments, the mode of a particular field should becontained in a certain percent of logs within that cluster in order forit to be included in the signature. In some embodiments, the minimumintra-cluster frequency is known as the minimum support (which inpractice is usually >90%). As used herein, “support” refers to thefrequency of an attribute in a group of logs. In some embodiments, theminimum support controls how many keys are reported to the user, but mayalso filter out rarely seen keys that are not represented by themajority of logs grouped by a cluster.

If single clusters grow too large, then finding the mode may become bothtime and space intensive. In some embodiments, to reduce the time andspace complexity, recently processed logs are stored in tree datastructures that have a one-to-one correspondence with each cluster.These tree structures are referred to herein as “replay trees.” In someembodiments, replay trees store counts of attributes contained in logsgrouped by a cluster. If the replay tree grows too large, periodicpruning of the tree may be performed so that attributes that have notbeen seen enough within a specified timeout are deleted until thatattribute is observed again. In some embodiments, to compute thesignature, the tree is processed in post-order, keeping track of themost common attribute with frequency greater than the minimum support.Note this means that logs contained in a cluster may not completelymatch their signature if the minimum support is less than 100%.

Example

Suppose the following example dataset of three structured logs:

Log 0 {‘a’: ‘apple’, ‘b’: ‘banana’, ‘c’: ‘cookies’, ‘d’: {‘i’:‘dinosaur’, ‘o’: ‘dough’}}

Log 1 {‘a’: ‘apple’, ‘b’: ‘bike’, ‘c’: ‘cookies’, ‘d’: {‘i’: ‘dinosaur’,‘o’: ‘dodo’}}

Log 2 {‘a’: ‘apple’, ‘b’: ‘bike’, ‘c’: ‘chocolate’, ‘d’: ‘deep’}

The following example cluster signatures are output:

Cluster 0 {‘a’: ‘apple’, ‘c’: ‘cookies’, ‘d’: {‘i’: ‘dinosaur’}}

Cluster 1 {‘a’: ‘apple’, ‘b’: ‘bike’, ‘c’: ‘chocolate’, ‘d’: ‘deep’}

where log 0 and log 1 belong to cluster 0 and log 2 belongs tocluster 1. Here are observations that suggest that the cluster output isa reasonable clustering result:

Log 2 had a different schema than log 0 and log 1 since the key containsa string value instead of a nested JSON. Allocating log 2 to its owncluster is the best choice.

Since log 2 is in its own cluster, the signature should match log 2.

Cluster 0, shared by log 0 and log 1, only contains keys that overlapbetween the two logs.

CloudTrail Example

The following is an example output from 100,000 logs of CloudTrail data.

Number of clusters: 8

Count: 37466 {‘eventVersion’: ‘1.05’, ‘userIdentity’: {‘type’:‘AssumedRole’, ‘accountId’: ‘00000000000’, ‘sessionContext’:{‘attributes': {‘mfaAuthenticated’: ‘false’}, ‘sessionIssuer’: {‘type’:‘Role’, ‘principalId’: ‘ADFLJDFALSDKLFJASLDKLFJ’, ‘arn’:‘arn:aws:iam::00000000000:role/us2-cloudcollector-role-for-instance-profile’,‘accountId’: ‘00000000000’, ‘userName’:‘us2-cloudcollector-role-for-instance-profile’}}}, ‘eventSource’:‘sts.amazonaws.com’, ‘eventName’: ‘AssumeRole’, ‘awsRegion’:‘us-east-1’, ‘userAgent’: ‘aws-sdk- java/1.11.587 Linux/4.15.0-1045-awsOpenJDK_64-Bit_Server_VM/25.222-b10 java/1.8.0_222 scala/2.11.12vendor/Private_Build’, ‘requestparameters': {‘roleSessionName’:‘sumologic’, ‘durationSeconds': 3600}, ‘eventType’: ‘AwsApiCall’,‘recipientAccountId’: ‘00000000000’}------------------------------------- Count: 23729 {‘eventVersion’:‘1.05’, ‘userIdentity’: {‘type’: ‘AssumedRole’, ‘accountId’:‘00000000000’, ‘sessionContext’: {‘attributes': {‘mfaAuthenticated’:‘false’}, ‘sessionIssuer’: {‘type’: ‘Role’, ‘principalId”:‘ADFLJDFALSDKLFJASLDKLFJ’, ‘arn’:‘arn:aws:iam::00000000000:role/us2-cloudcollector-role-for-instance-profile’,‘accountId’: ‘00000000000’, ‘userName’:‘us2-cloudcollector-role-for-instance-profile’}}}, ‘eventSource’:‘sts.amazonaws.com’, ‘eventName’: ‘AssumeRole’, ‘awsRegion’:‘us-east-1’, ‘requestparameters': {‘roleSessionName’: ‘sumologic’,‘durationSeconds': 3600}, ‘eventType’: ‘AwsApiCall’,‘recipientAccountId’: ‘00000000000’}------------------------------------- Count: 10439 {‘eventVersion’:‘1.05’, ‘userIdentity’: {‘type’: ‘AssumedRole’, ‘accountId’:‘00000000000’, ‘sessionContext’: {‘attributes': {‘mfaAuthenticated’:‘false’}, ‘sessionIssuer’: {‘type’: ‘Role’, ‘accountId’:‘00000000000’}}}, ‘eventSource’: ‘sts.amazonaws.com’, ‘eventName’‘AssumeRole’, ‘awsRegion’: ‘us-east-1’, ‘requestparameters':{‘roleSessionName’: ‘sumologic’, ‘durationSeconds': 3600}, ‘eventType’:‘AwsApiCall’, ‘recipientAccountId’: ‘00000000000’}------------------------------------- Count: 9522 {‘userIdentity’:{‘accountId’: ‘00000000000’}, ‘awsRegion’: ‘us-west-2’, ‘eventType’:‘AwsApiCall’, ‘recipientAccountId’: ‘00000000000’}------------------------------------- Count: 7492 {‘userIdentity’:{‘type’: ‘AssumedRole’, ‘accountId’: ‘00000000000’, ‘sessionContext’:{‘sessionIssuer’: {‘type’: ‘Role’, ‘principalId’: ‘00000000000’, ‘arn’:‘arn:aws:iam::00000000000:role/hcvault’, ‘accountId’: ‘00000000000’,‘userName’: ‘hcvault’}, ‘attributes': {‘mfaAuthenticated’: ‘false’}}},‘awsRegion’: ‘us-west-2’, ‘sourceIPAddress': ‘54.193.127.227’,‘userAgent’: ‘aws-sdk-java/1.11.587 Linux/3.13.0-123-generic OpenJDK_64-Bit_Server_VM/25.111-b14 java/1.8.0_111 scala/2.11.12vendor/Oracle_Corporation’, ‘eventType’: ‘AwsApiCall’,‘recipientAccountId’: ‘00000000000’}------------------------------------- Count: 4985 {‘eventVersion’:‘1.05’, ‘userIdentity’: {‘type’: ‘AssumedRole’, ‘accountId’:‘00000000000’, ‘sessionContext’: {‘attributes': {‘mfaAuthenticated’:‘false’}, ‘sessionIssuer’: {‘type’: ‘Role’, ‘accountId’:‘00000000000’}}}, ‘eventSource’: ‘sts.amazonaws.com’, ‘eventName’:‘AssumeRole’, ‘awsRegion’: ‘us-east-1’, ‘userAgent’:‘aws-sdk-java/1.11.587 Linux/4.15.0-1048- awsOpenJDK_64-Bit_Server_VM/25.222-b10 java/1.8.00_222 scala/2.11.12vendor/Private_Build’, ‘eventType’: ‘AwsApiCall’, ‘recipientAccountId’:‘00000000000’} ------------------------------------- Count: 4484{‘eventVersion’: ‘1.05’, ‘userIdentity’: {‘type’: ‘AssumedRole’,‘accountId’: ‘00000000000’, ‘sessionContext’: {‘attributes':{‘mfaAuthenticated’: ‘false’}, ‘sessionIssuer’: {‘type’: ‘Role’,‘principalId’: ‘0000000000000’, ‘arn’:‘arn:aws:iam::00000000000:role/prod-cloudcollector-role-for-instance-profile’, ‘accountId’: ‘00000000000’,‘userName’: ‘prod- cloudcollector-role-for-instance-profile’}}},‘eventSource’: ‘sts.amazonaws.com’, ‘eventName’: ‘AssumeRole’,‘awsRegion’: ‘us-east-1’, ‘requestparameters': {‘roleSessionName’:‘sumologic’, ‘durationSeconds': 3600}, ‘eventType’: ‘AwsApiCall’,‘recipientAccountId’: ‘00000000000’}------------------------------------- Count: 1883 {‘userIdentity’:{‘type’: ‘AssumedRole’, ‘principalId’: ‘00000000000:vault-aws-AutoscaleBox-developer-sts-2222222222-2222’, ‘arn’: ‘arn:aws:sts::00000000000:assumed-role/hcvault/vault-aws-AutoscaleBox-developer-sts-1111111111-1111’,‘accountId’: ‘00000000000’, ‘accessKeyId’: ‘ASIA5PJ3ID4S6DR3COH3’,‘sessionContext’: {‘sessionIssuer’: {‘type’: ‘Role’, ‘principalId’:‘AROAIMLL434MSBIJMBJGQ’, ‘arn’: ‘arn:aws:iam::00000000000:role/hcvault’,‘accountId’: ‘00000000000’, ‘userName’: ‘hcvault’}, ‘attributes':{‘creationDate’: ‘2019-09-18T19:04:34Z’, ‘mfaAuthenticated’: ‘false’}}},‘awsRegion’: ‘us-west-2’, ‘sourceIPAddress': ‘54.193.127.227’,‘userAgent’: ‘aws-sdk-java/1.11.587 Linux/3.13.0-123-genericOpenJDK_64-Bit_Server_VM/25.111-b14 java/1.8.0_111 scala/2.11.12vendor/Oracle_Corporation’, ‘eventType’: ‘AwsApiCall’,‘recipientAccountId’: ‘00000000000’}------------------------------------- Total Count: 100000

Example for Dealing with Mode Collapse

In some embodiments, mode collapse may be dealt with by the followingexample actions:

-   -   Increase the slack on the number of clusters as the number of        data points processed increases. Mode collapse can be a result        of overly constraining the number of clusters to be smaller than        necessary.    -   Increase penalty on missing keys. Large clusters tend to have        less attributes in their signatures due to the minimum support        threshold criterion. If the penalty on missing keys is        increased, then logs are less likely to be matched with        signatures with a low number of attributes.    -   Decrease hyperparameters that encourage clusters to collapse.    -   Divide by the union of keys in the loss function. Large clusters        tend to have signatures with a low number of keys. Points are        less likely to match with small clusters since dividing by the        union of keys within flattened structured logs that is compared        is performed.

Example Extensions

-   -   In some embodiments, clustering on categorical fields is        supported. One example extension is to support clustering on        normalized numerical and string values.    -   Reduce instances of redundant signatures. A signature is        redundant of another signature if one signature contains a        subset of attributes contained in another signature.    -   Reduce number of singleton clusters. Singleton clusters are        clusters that only contain a single log. When one data point is        allocated to its own cluster, the signature represented by that        cluster is just the log line itself. In general, singleton        clusters are undesirable especially if they commonly occur,        unless outliers are being intentionally surfaced to        users/customers.

FIG. 9 is a flow diagram illustrating an embodiment of a process forclustering structured log data by values. In some embodiments, process900 is executed by platform 102 of FIG. 1. In some embodiments, process900 is executed in response to a user invoking the LogReduce Valuesoperator described herein. The process begins at 902 when a request isreceived, via a user interface, to apply an operator to cluster a set ofraw log messages according to values for a set of keys associated withthe request. At least a portion of each raw log message comprisesstructured machine data that includes a set of key-value pairs. At 904,a raw log message in the set of raw log messages is received. At 906, itis determined whether to include the raw log message in a cluster basedat least in part on an evaluation of values in the structured machinedata of the raw log message for the set of keys associated with therequest. The cluster is included in a plurality of clusters. Eachcluster in the plurality is associated with a different combination ofvalues for the set of keys associated with the request. At 908,information associated with the cluster is provided via the userinterface.

The following are examples illustrating various portions of process 900.Examples involving JSON and CSV format cases are described below forillustrative purposes. In some embodiments, unless separate JSON and CSVcases are specifically mentioned, the below apply to both formats.

JSON

FIG. 4E illustrates an embodiment of input raw log data that can beoperated on by the LogReduce Values operator. In some embodiments, thesame input as in the LogReduce Keys example above may be used.

CSV Figures 10A and 10B illustrate embodiments of a CSV formatted inputraw log. The following are examples of user input using the LogReduceValues operator: JSON _index=streamlogs explainJsonPlan ETT | parse″explainJsonPlan.ETT *″ as _json | json field=_json “customerId”,“callerModule”, “statusMessage” | logreduce values on customerId,callerModule, statusMessage CSV/Delimited CSV / DELIMITED_index=streamlogs explainJsonPlan ETT | parse ″[auth=*]″ as authString |split authString delim=′:′ extract accttype, email, userid, orgid,isadmin, authtype, usercode, authfamily | logreduce values on email,authtype, authfamily

The following is an example of how values are obtained for thestructured log data in a raw log message, as well as example datastructure representations for the extracted values. The above querystrings illustrate example ways of how to parse the structured valuesout of the individual logs, after which, in some embodiments, they arerepresented as Map[String, String] (map/dict/table of field names totheir values for that particular log event). In some embodiments, toextract values in the structured data, various parsers may be applied(e.g., JSON, CSV, delimiter, key-value, xml, etc.) to convert each loginto the structured key-value map representation.

FIG. 10B illustrates an embodiment of how the extracted values are usedto determine which specific cluster that a raw log message should beadded to. In some embodiments, unsupervised clustering is used todetermine the particular cluster in which to include the raw logmessage. For example, unsupervised clustering may be used to determine,given the above example Map[String,String] data structures, how togroup/partition them by similarity in such a way to maximizeintra-cluster similarities and minimize inter-cluster similarities.

The following is an example of how to associate a raw log message with acluster. In one embodiment, each cluster is represented by the valuecount histograms for each key (for example, in Scala data structure,something such as Map[String, Map[String,Int]]—map from each key to acount map from each value to its associated frequency count) and then todefine a distance function between a single log event Map[String,String]and each cluster count representation.

An incoming log is assigned to the “closest” cluster, if the similarityexceeds some threshold (r (tau) in the example below). If not, itbecomes the initial member of a new cluster.

The following is an example of clustering structured log data by values:K=total number of keys

N_(j)=total number of logs in cluster j

X[k]=the value of k from row X

H_(j)[k,v]=the count of key-value pair (k,v) seen in cluster j

${{sim}\left( {X,{Hj}} \right)} = {\frac{1}{{KN}_{j}}\Sigma_{k}\mspace{14mu}{H_{j}\left\lbrack {k,{X\lbrack k\rbrack}} \right\rbrack}}$

Example Algorithm for LogReduce Values

Input: Stream of rows X Result: Clusters H = {H₁, H₂, ...} foreach row Xdo if H = Ø then add X to H else k = argmin_(j) sim(X, H_(j)); s =sim(X, H_(k)); if s > τ then add X to H_(k) else add X to H; end end end

FIG. 11 illustrates an example list of information that can be providedvia the UI as output of performing the LogReduce Values operator.

The following is an example implementation of how to highlightdifferences between clusters in the UI for LogReduce Values. In someembodiments, in the UI, each cluster is represented by its“prototype”—the modal (e.g., most frequent) key-value pairs for thatcluster. This should give the most accurate at-a-glance “canonical”representation of the cluster contents. Also, in some embodiments, thecount of the number of logs assigned to the cluster is a hyperlink thatallows the user to click and directly inspect (or further query/process)the raw logs associated with that cluster.

FIGS. 4A-4G illustrate an embodiment showing interoperability of theLogReduce Keys and LogReduce Values operators described herein. In thisexample, the LogReduce Keys and LogReduce Values have been stitchedtogether (e.g., applied sequentially, with LogReduce Values afterLogReduce Keys) to discover/investigate unusual query behavior (e.g.,unknown caller module).

The following is an example of running the LogExplain operator describedherein. A SecOps (Security Operations) user may wish to detectcompromised user credentials for Windows machines.

SecOps Insight: A hacked credential will display a remote login pattern(eventdata_logontype=10) where a given user logs into more machines thanthey usually do, based on eventid=4624 (login successful). Suppose inthis example that the user wants to baseline 14 days of remote accessactivity and detect outliers in the most recent 24 hours.

The following is an example of running LogExplain to investigateoutliers;

_sourceCategory=OS*Windows* eventid=4624 eventdata_logontype=10 | where!isBlank(eventdata_targetusername) &&!isBlank(eventdata_workstationname) | logexplain (now( ) − _messagetime< 86400000) on eventdata_workstationname, eventdata_targetusername

In this example, the user need only examine a small set of results(e.g., as compared to if querying using existing approaches). In thisexample, the LogExplain operator is able to detect users which were veryactive 14 days ago but are no longer or less active recently. This isimportant as hackers may have left the network by the time Sec Opschooses to run any of these queries. As shown in this example, theLogExplain query is easy for non-power users to create and assess ascompared to existing approaches.

Although the foregoing embodiments have been described in some detailfor purposes of clarity of understanding, the invention is not limitedto the details provided. There are many alternative ways of implementingthe invention. The disclosed embodiments are illustrative and notrestrictive.

What is claimed is:
 1. A system, comprising: a processor configured to:receive a raw log message, wherein at least a portion of the raw logmessage comprises structured machine data including a set of key-valuepairs; receive a map of keys to values; use the received map of keys tovalues to determine a key schema of the structured machine data, whereinthe key schema is associated with a corresponding cluster; and associatethe raw log message with the cluster corresponding to the determined keyschema; and a memory coupled to the processor and configured to providethe processor with instructions.
 2. The system recited in claim 1wherein the key schema comprises a combination of keys is present in theset of key-value pairs included in the structured machine data.
 3. Thesystem recited in claim 2 wherein the combination of keys present in theset of key-value pairs included in the structured machine data isdetermined at least in part by using a parser to extract keys in the setof key-value pairs included in the structured machine data.
 4. Thesystem recited in claim 1 wherein the cluster is associated with acluster identifier that is generated based at least in part on the keyschema.
 5. The system recited in claim 4 wherein the cluster identifiercomprises a hash of the key schema.
 6. The system recited in claim 1wherein the raw log message comprises a first raw log message, andwherein the processor is further configured to: receive a second raw logmessage; and associate the second raw log message with a differentcluster based at least in part on a determination that structured loginformation in the second raw log message has a different key schema. 7.The system recited in claim 1 wherein the determining of the key schemais performed in response to a request made, via a user interface, toapply an operator to cluster a set of raw log messages based on keys. 8.The system recited in claim 1 wherein the processor is furtherconfigured to present, via a user interface, an indication of thecluster.
 9. The system recited in claim 8 wherein the processor isfurther configured to present, via the user interface, informationpertaining to the cluster, the information comprising at least one of anumber of log messages present in the cluster and an indication of keyspresent in the key schema corresponding to the cluster.
 10. The systemrecited in claim 8 wherein the processor is further configured topresent, via is the user interface, a link to a view of raw log messagesin the cluster.
 11. A method, comprising: receiving a raw log message,wherein at least a portion of the raw log message comprises structuredmachine data including a set of key-value pairs; receiving a map of keysto values; using the received map of keys to values to determine a keyschema of the structured machine data, wherein the key schema isassociated with a corresponding cluster; and associating the raw logmessage with the cluster corresponding to the determined key schema. 12.The method of claim 11 wherein the key schema comprises a combination ofkeys present in the set of key-value pairs included in the structuredmachine data.
 13. The method of claim 12 wherein the combination of keyspresent in the set of key-value pairs included in the structured machinedata is determined at least in part by using a parser to extract keys inthe set of key-value pairs included in the structured machine data. 14.The method of claim 11 wherein the cluster is associated with a clusteridentifier that is generated based at least in part on the key schema.15. The method of claim 14 wherein the cluster identifier comprises ahash of the key schema.
 16. The method of claim 11 wherein the raw logmessage comprises a first raw log message, and further comprising:receiving a second raw log message; and associating the second raw logmessage with a different cluster based at least in part on adetermination that structured log information in the second raw logmessage has a different key schema.
 17. The method of claim 11 whereinthe determining of the key schema is performed in response to a requestmade, via a user interface, to apply an operator to cluster a set of rawlog messages based on keys.
 18. The method of claim 11 furthercomprising presenting, via a user interface, an indication is of thecluster.
 19. The method of claim 18 further comprising presenting, viathe user interface, information pertaining to the cluster, theinformation comprising at least one of a number of log messages presentin the cluster and an indication of keys present in the key schemacorresponding to the cluster.
 20. The method of claim 18 furthercomprising presenting, via the user interface, a link to a view of rawlog messages in the cluster.
 21. A computer program product embodied ina non-transitory computer readable storage medium and comprisingcomputer instructions for: receiving a raw log message, wherein at leasta portion of the raw log message comprises structured machine dataincluding a set of key-value pairs; receiving a map of keys to values;using the received map of keys to values to determine a key schema ofthe structured machine data, wherein the key schema is associated with acorresponding cluster; and associating the raw log message with thecluster corresponding to the determined key schema.